This is a discussion on Reusing common html code on multiple pages within the Coding Help forums, part of the Webmaster Help category; Hi, I'm pretty new to HTML, so bear with me. I'm working on a standard problem - I have multiple ...
| |||||||
| Register | Forum Rules | FAQ | Donate | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I'm pretty new to HTML, so bear with me. I'm working on a standard problem - I have multiple html pages with common content (header and footer). I want to have to update this common information in one place only. My web research has lead me to SSI's and Javascript. The SSI solution looks neat, but requires a new directive in my .htaccess if I want to hide the fact them I'm using SSI's (which I think I do). Also, this leads to an overhead on the part of the web server. The JS solution also looks neat - embed the html within a document.write command in a text file and call this as a script from wherever I want to use it. Question is: Am I missing something in either of these approaches (other advantages/disadvantages). Also, is there another (better) solution that coders prefer to use? Thanks, jomag |
| |||||
| Does your server have PHP ? make a file called test.php and paste in PHP Code:
__________________ my sites : irish poker / irish jobs / seo faq / advertise jobs free / green card / skiing |
| ||||
| I would use php includes or just use templates (if possible) in your web authoring software. Javascript might give you problems SEO wise and will add unnecessary bulk to the page. For example to use a php include simply give your page a .php extension and put the code below in it. Code: <? include('my_header.html'); ?>
|
| |||||
| you may want to have <?PHP instead of just <? (<? doesn't normally work by default .. it has to be set in the ini )
__________________ Forbairt Media | Web Design Dublin, Ireland - Web Development Dublin, Ireland Recent Work: Safari Club African Safari Holiday - South Africa Holiday Safaris Other Stuff: FluffyLinkulator Rapid Inclusion Service Tool |
| ||||
| Thanks for the fast replies guys. I had a feeling there would be a simple solution. I've done a quick test as I'm running PHP, and it works just fine. I've a bit more work to do on the site and then I'll publish and ask for a critique. Thanks again. jomag |
| Tags |
| code, common, html, multiple, pages, reusing |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| HTML vs PHP pages? | niky | Search Engine Optimisation | 11 | 26-11-2008 04:04 PM |
| Common Misspellings and SEO? | gav240z | Search Engine Optimisation | 10 | 12-05-2008 09:37 AM |
| Looking for a dictionary of common words... | Forbairt | Coding Help | 2 | 01-02-2008 01:41 PM |
| ||||
| | ![]() | |||
| | ||||