Click to See Complete Forum and Search --> : A function to load a variable and to return a variable


AnotherMuggle
03-28-2008, 05:03 PM
I have a load of PHP functions, inside classes, that build my HTML pages for me.

I have one particular function that I want to build part of the page (it already does this), but also I want it to pass back a variable to the main code.

If I do something such as the following:

// Displays a list of all the forum topics
$title = $forum->topicList($forumID);

// Loads output of the forum class into the $forumOutput variable
$forumOutput = $forum->get();

The $forumOutput variable will hold the completed HTML content. This is working OK.

Will the $title variable hold the value that is returned by the topicList function?
Is this the correct way to go about this?

I hope that makes sense.

Cheers,
TK

TJ111
03-28-2008, 06:04 PM
As long as topicList() returns value, then yes $title will contain whatever is returned.