Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: PHP Links

  1. #1
    New Coder
    Join Date
    Sep 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP Links

    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.

  • #2
    Banned
    Join Date
    Apr 2007
    Posts
    428
    Thanks
    29
    Thanked 5 Times in 5 Posts
    you can use something like this for navigation

    navigation.php

    PHP Code:
    $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
    PHP Code:
    include ("navigation.php"); 
    Where you want to show your links, just call this function

    PHP Code:
    showNavigation($navigation); 
    That function will produce this HTML code

    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>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •