PX : code

Section Manager by David Reid
Download this code


<!--section_man.php3-->
<?php
// Section manager
// By: David Reid (Eidd@Beerninjas.org)
// Use and modify as you wish but please email me any significant improvements
//
    
if(empty($section_id))
    {
        
$section_id 0;
    }

    function 
display_menu($oreintation$menu$section_id
    {
        if(
$oreintation == "v")
        {
            print(
"<MENU>\n");
            for(
$i 0$i count($menu); $i++)
            {
                if(
$section_id == $i)
                {
                    print(
"<LI>$menu[$i]</LI>");
                }
                else
                {
                    print(
"<LI><A HREF=\"$PHP_SELF?section_id=$i\">$menu[$i]</A></LI>");
                }
            }
            print(
"</MENU>");
        }
        elseif(
$oreintation == "h")
        {
            print(
"- ");
            for(
$i 0$i count($menu); $i++)
            {
                if(
$section_id == $i)
                {
                    print(
"$menu[$i] -");        
                }
                else
                {
                    print(
"<A HREF=\"$PHP_SELF?section_id=$i\">$menu[$i]</A> - ");
                }
            }
        }
    }

    function 
display_content($menu$section_id)
    {
        
$section $menu[$section_id];
        return 
$section;
    }

?>

<!--demo.content-->

<H1 ALIGN="center"> This is a demo of section_man.php3. </H1>

<!--demo.php3-->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>

<HEAD>
<TITLE>Section Manager Demo</TITLE>
</HEAD>
<BODY>
<?php
    
include("section_man.php3");
    
$menu = array("demo""dead_link""also_dead_link");
    
// horizontal menu
    
display_menu('h'$menu$section_id);
    
// vertical menu
    // display_menu('v', $menu, $section_id);
?>
<HR WIDTH="100%">
<?php
    
include("$section.content");
?>
</BODY></HTML>

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.