...

View Full Version : PHP Links



Lyss
08-21-2007, 09:51 AM
I've just changed from using an iframe to a table, because I want the content to expand appropriately. So I was wondering if I can use PHP on the navigation so they load into the table?

If so, what code would I use?

www.dhfics.com
Thanks.

matak
08-21-2007, 10:44 AM
you can use something like this for navigation

navigation.php



$navigation = array (

"http://www.example.com/page1.php" => "page1",
"http://www.example.com/page2.php" => "page2",
"http://www.example.com/page3.php" => "page3"
);

function showNavigation($variable) {

echo "<ul>\n";
foreach ($variable as $key => $var) {

echo "<li><a href=\"$key\">$var</a></li>\n";

}
echo "</ul>\n";


}


then include that navigation.php on top of every page you have with this


include ("navigation.php");

Where you want to show your links, just call this function


showNavigation($navigation);

That function will produce this HTML code


<ul>
<li><a href="http://www.example.com/page1.php">page1</a></li>
<li><a href="http://www.example.com/page2.php">page2</a></li>
<li><a href="http://www.example.com/page3.php">page3</a></li>
</ul>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum