1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Newbie ?- Best method using repeating source on mult. pages

Discussion in 'Web Design, HTML And CSS Forums' started by chicubswally, Jul 27, 2007.

  1. chicubswally

    chicubswally New Member

    Hello all,
    Great forum! It seems there are many experts here.

    This might be a quick question someone could easily answer.

    I have exactly the same code in many of my web site's pages. It's navigation bar code.

    Would it be best to store this in another file and bring it into each page with just a couple of similar lines of code in each page?

    Thanks in advance for your advice.

  2. shabbir

    shabbir Administrator Staff Member

    That would be one of the better option. Other option could be to have a template based and fetch the header / navigation for each page and if some pages don't need it you can avoid the fetching for that page.
  3. chicubswally

    chicubswally New Member

    But how do I do this? Could someone give me an example please?


  4. shabbir

    shabbir Administrator Staff Member

    Say you have templates and read the content of the template file from the xyz.php based on the requirement and build on the html of the pages.
  5. chicubswally

    chicubswally New Member

    Sorry, don't know what a template file or php is... could you help by elaborating (example) please. Thanks
  6. shabbir

    shabbir Administrator Staff Member

    A template file is some file which has some html code in it.

    Say I have 2 files

    Which contains the specific html content for the header, body and footer respectively and based on the requirement you can get the content of the file and append it to the page as and when needed.
  7. chicubswally

    chicubswally New Member

    Is this a cut and paste process?

    Where you specify body.html, I have several 'main' pages of bodies......
    If I had a main1.html, main2.html, and main3.html for example, would I cut and paste the header and footers into these three documents?

    Thank you again!
  8. shabbir

    shabbir Administrator Staff Member

    How simple or complex your case would be is upto your initial design but it should be simple segregation of html and web server language as far as I can see it.

Share This Page