Page 1 of 1

Looking For Exmples

Posted: Sun May 02, 2010 5:42 pm
by JakeJ
I'm building a header page and all of my content is coming from include files.

Does anyone have some good examples of building navigation from include files? There will be different navigation buttons for the side bar as well as a menu across the top. But just having one or the other would be great and I can adapt from there.

Feel free to either post code and/or attach files.

Thanks!

Re: Looking For Exmples

Posted: Sun May 02, 2010 7:01 pm
by requinix
For simple stuff I have two functions: one for outputting the header, one for outputting the footer. The two functions take arguments and decide what to do from there.

Like

Code: Select all

<?php // include file

function page_header($title, $nav1, $nav2) {
    // echo the HTML that appears before the content
    // use $nav1 and $nav2 to decide what buttons should be marked as active/currently being visited
}

function page_footer() {
    // echo the HTML that appears after the content
}

Code: Select all

<?php

include "include file";

page_header("Page title", "First", "Second");

// print page content

page_footer();
There are a billion ways to do this. Come up with something that seems simple and logical to you.

Re: Looking For Exmples

Posted: Sun May 02, 2010 7:40 pm
by JakeJ
Thanks,

And I know there's a billion ways, I'm just looking for some examples so I can get an idea of what's going to work best for me since I haven't had the need to do this.

Keep the examples coming!