www.webdeveloper.com
Results 1 to 7 of 7

Thread: best include strategy...

  1. #1
    Join Date
    Aug 2003
    Posts
    1,576

    best include strategy...

    Just a hypothetical, which is a better include strategy...

    include header
    content
    include footer

    or

    header
    include content
    footer

    basically, is it better to have the server include the content, or everything but the content? or something else entirely?

  2. #2
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,222
    Page with content --> includes everthing else all at one time, the whole layout, nav, header so on and so fourth. BTW: I use css for layout so its not like the order of stuff will affect how it is positioned.

  3. #3
    Join Date
    Nov 2002
    Posts
    2,632
    Include header, footer, and anything else that would stay constant on all of your pages. Let the content be because it will change on every page. Since you are using includes, take something like PHP and you can use the OOP aspect of it to define a class which defines your variables, and functions for the site and then you can call what you need. Check out the link below for a preview version of PHP Anthology I & II and you'll see this in action.

    http://www.sitepoint.com/books/phpant1/

  4. #4
    Join Date
    Feb 2003
    Location
    Wales, UK
    Posts
    3,147
    My Method is

    doctype
    <head>

    <title>Title is specific to each page, and useful for search engines.</title>

    include css files, common meta tags etc.

    add any specific meta tags directly onto the page.
    </head>
    <body>

    include anything above content within html - e.g. opening div tags,

    Content

    Include </div>s and menu

    </body>
    </html>

  5. #5
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    My method:

    PHP Code:
    <?PHP
    include $_SERVER['DOCUMENT_ROOT']."/header.php";
    ?>
    <p>content...</p>
    <?PHP
    include $_SERVER['DOCUMENT_ROOT']."/footer.php";
    ?>
    Basically, choice number one. You might want to check out this as well, as it's very beneficial to change certain content in the header (such as the title or meta information). Depending on how you want to structure your header, you can either use the method I use (described in the entry) or use the method in the first user comment.

  6. #6
    Join Date
    Aug 2003
    Posts
    1,576
    Pyro: Very helpful article, as always, thanks a bunch
    Spufi: OOP isn't new to me, just wondering how everything was implementing SSI's

  7. #7
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    Originally posted by samij586
    Pyro: Very helpful article, as always, thanks a bunch
    Certainly.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles