Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Web Design, HTML And CSS Forums (http://www.go4expert.com/forums/web-design-forum/)
-   -   Newbie ?- Best method using repeating source on mult. pages (http://www.go4expert.com/forums/newbie-method-using-repeating-source-t5499/)

chicubswally 27Jul2007 22:48

Newbie ?- Best method using repeating source on mult. pages
 
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.

Wally

shabbir 28Jul2007 09:58

Re: Newbie ?- Best method using repeating source on mult. pages
 
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.

chicubswally 28Jul2007 17:34

Re: Newbie ?- Best method using repeating source on mult. pages
 
But how do I do this? Could someone give me an example please?

Thanks!

Quote:

Originally Posted by shabbir
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.


shabbir 28Jul2007 22:18

Re: Newbie ?- Best method using repeating source on mult. pages
 
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.

chicubswally 28Jul2007 23:36

Re: Newbie ?- Best method using repeating source on mult. pages
 
Newbie...
Sorry, don't know what a template file or php is... could you help by elaborating (example) please. Thanks
Quote:

Originally Posted by shabbir
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.


shabbir 29Jul2007 10:15

Re: Newbie ?- Best method using repeating source on mult. pages
 
A template file is some file which has some html code in it.

Say I have 2 files
header.html
body.html
footer.html

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.

chicubswally 30Jul2007 18:46

Re: Newbie ?- Best method using repeating source on mult. pages
 
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!

shabbir 31Jul2007 08:54

Re: Newbie ?- Best method using repeating source on mult. pages
 
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.


All times are GMT +5.5. The time now is 15:40.