Irish SEO,  Marketing & Webmaster Discussion

 

Reusing common html code on multiple pages

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 ...


Go Back   Irish SEO, Marketing & Webmaster Discussion > Webmaster Help > Coding Help

Register Forum Rules FAQDonate Calendar Search Today's Posts Mark Forums Read

  #1 (permalink)  
Old 27-08-2008, 09:11 AM
Frontpage User
 
Join Date: Aug 2008
Posts: 16
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
askaboutfood.ie will become famous soon enough
Default Reusing common html code on multiple pages

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 27-08-2008, 09:28 AM
paul's Avatar
ninja SEO
 
Join Date: Dec 2006
Location: .de
Posts: 1,251
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
paul has much to be proud ofpaul has much to be proud ofpaul has much to be proud ofpaul has much to be proud ofpaul has much to be proud ofpaul has much to be proud ofpaul has much to be proud ofpaul has much to be proud ofpaul has much to be proud ofpaul has much to be proud of
Default

Does your server have PHP ?
make a file called test.php and paste in
PHP Code:
  <?php

// Show all information, defaults to INFO_ALL
phpinfo();

// Show just the module information.
// phpinfo(8) yields identical results.
phpinfo(INFO_MODULES);

?>
and let us know the results. Then you can use easy calls via the include command on PHP.
__________________
my sites :
irish poker / irish jobs / seo faq / advertise jobs free / green card / skiing
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 27-08-2008, 09:41 AM
Tom Tom is offline
Wannabe Geek
 
Join Date: Jan 2007
Location: Kildare, Ireland
Posts: 223
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Tom is a splendid one to beholdTom is a splendid one to beholdTom is a splendid one to beholdTom is a splendid one to beholdTom is a splendid one to beholdTom is a splendid one to beholdTom is a splendid one to behold
Default

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'); ?>
Actually SSI is a server side include, just looked it up (acronyms!) so that's basically the php option if you're server has php. You shouldn't need to mess with a .htaccess to get it working but it depends on your setup I guess.
__________________
MGS Web Design - Web Design Kildare, Web Design Ireland
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 27-08-2008, 10:03 AM
Forbairt's Avatar
respect my AW-THOR-IT-AYY
 
Join Date: Jun 2007
Location: My Office, Dublin
Posts: 2,157
Nominated 2 Times in 1 Post
Nominated TOTW/F/M Award(s): 1
Forbairt will become famous soon enoughForbairt will become famous soon enoughForbairt will become famous soon enoughForbairt will become famous soon enoughForbairt will become famous soon enoughForbairt will become famous soon enoughForbairt will become famous soon enoughForbairt will become famous soon enoughForbairt will become famous soon enoughForbairt will become famous soon enoughForbairt will become famous soon enough
Send a message via AIM to Forbairt Send a message via MSN to Forbairt Send a message via Yahoo to Forbairt Send a message via Skype™ to Forbairt
Default

Quote:
Originally Posted by Tom View Post
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 27-08-2008, 10:37 AM
Frontpage User
 
Join Date: Aug 2008
Posts: 16
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
askaboutfood.ie will become famous soon enough
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
code, common, html, multiple, pages, reusing

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

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


Sponsored links

Pepperjam Network
Paid On Results www.zanox.com


All times are GMT +1. The time now is 06:47 PM.


Powered by: vBulletin Version 3.8.2, Copyright ©2000 - 2009, Jelsoft Enterprises Limited.
Hosted in Ireland by Blacknight - Test your ISP |Irish Hosting Directory| Armchair.ie|Logo by Eden Web Design|Avatars by Afterglow |Latest Blog Entries | VPS HostingAd Management by RedTyger

Search Engine Friendly URLs by vBSEO 3.3.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51