Re: calling functions to form menus

From: Date: Mon, 04 Dec 2000 21:56:14 +0000
Subject: Re: calling functions to form menus
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-28648@lists.php.net to get a copy of this message
DOH! pring RETURNS 1 :O) just do $menu .= "<a href=\"http://ipo.asu.edu/$val.php\">$val</a><br>\n"; --Joe On Mon, Dec 04, 2000 at 02:54:30PM -0700, webmaster@ipo.vpaa.asu.edu wrote: > Thanks for replying so quickly. > > > Actually my Menu() function is a while loop which forms the links from > an array of values. > > $options = array("home", "incoming", "outgoing"); > > while (list ($key, $val) = each ($options)) { > $menu .= print("<a > > href=\"http://ipo.asu.edu/$val.php\">$val</a><br>\n"); > } > return $menu; > > slightly modified from another response I received. This returns "1111" > when it's called and the output is in the correct place. Also it's still > outputing the correct menu above the main table. > > Any other suggestions would be most appriciated. > > Thanks. > > On Mon, Dec 04, 2000 at 01:26:10PM -0800, Joe Stump wrote: > > Sounds like your functions look like this: > > > > Menu() > > { > > echo $link1; > > echo $link2; > > } > > > > when they need to look like this: > > > > Menu() > > { > > $ret .= $link1; > > $ret .= $link2; > > > > return $ret; > > } > > > > Basically assign EVERYTHING that is supposed to be "echo"'d and then return > > that > > into your next function. > > > > --Joe > > > > On Mon, Dec 04, 2000 at 02:21:17PM -0700, webmaster@ipo.vpaa.asu.edu wrote: > > > Greetings, > > > > > > Got a tiny problem that I'm unable to figure out. In one file I've > > > written two functions, one which forms the table layout for the page, > > > and another which forms the links that make up the menu side of the > > > table. > > > > > > In the page that calls the functions I've tried assigning the output of > > > the Menu() function to a variable $menu and insert it into the main > > > page. > > > > > > require("FormatPage.php"); > > > > > > $menu = Menu(); > > > $title ="stuff"; > > > $header="more stuff"; > > > > > > MainPage($title, $header, $menu); > > > > > > > > > The menu does not get placed inside the table of MainPage, instead it's > > > formed above the table. Other than that the functions work fine. > > > > > > Is there any way to assign the output of a function to a single variable > > > and place it inside the table where it's supposed to be? > > > > > > Thanks. > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > > For additional commands, e-mail: php-general-help@lists.php.net > > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > ----- > > Joe Stump, PHP Hacker > > joestump98@yahoo.com > > http://www.miester.org/ > > > > Need a programmer? > > http://www.google.com/search?q=%22Joe+Stump%22 > > ***************************************************************** > > * RENT THIS SPACE - SEEN BY THOUSANDS EACH DAY! * > > * Current Sponsor: http://www.smackdown.com > > * > > ***************************************************************** > > ----- Joe Stump, PHP Hacker joestump98@yahoo.com http://www.miester.org/ Need a programmer? http://www.google.com/search?q=%22Joe+Stump%22 ***************************************************************** * RENT THIS SPACE - SEEN BY THOUSANDS EACH DAY! * * Current Sponsor: http://www.smackdown.com * *****************************************************************

« previous php.general (#28648) next »