replace with display function

From: Date: Tue, 18 Sep 2001 14:30:23 +0000
Subject: replace with display function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-67713@lists.php.net to get a copy of this message
Hi, I am working on replacing strings in a navigation file. I need to be able to assemble the left navigation from a table. My problem is the function code gets placed above where it should appear in the template. Here is what I have: $temp5 = str_replace("[LEFT NAV]",call_leftnav(),$temp4); echo $temp5; function call_leftnav() { print ("<table border=0 cellpadding=0 cellspacing=0><tr><td width=90%>&nbsp;</td><td>&nbsp;</td></tr>"); $connection = mssql_connect("localhost","webuser",""); $db = mssql_select_db("wmn_test",$connection); $sql = "select bp_section_id,bp_section_name from bp_sections order by bp_section_name"; $sql_result = mssql_query($sql); while ($row = mssql_fetch_array($sql_result)){ $bp_section_id = $row["bp_section_id"]; $bp_section_name = $row["bp_section_name"]; print ("<tr><td><a href=\"bpsection.php?section=$bp_section_id\">$bp_section_name</a></td><td></td></tr>"); }; print ("</table>"); }; ?>

« previous php.general (#67713) next »