Web Design Forum: Include a piece of HTML code from a file into a page? - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Include a piece of HTML code from a file into a page?

#1 User is offline   CBG 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 164
  • Joined: 21-February 09
  • Reputation: 0
  • Location:England, UK
  • Experience:Intermediate
  • Area of Expertise:Video Production

Posted 09 January 2010 - 07:44 PM

I have the homepage and a few other pages that have a peice of code on them that needs to be changed a lot, how can I change these all at once without doing it manually. Ideally I'd like to have a seperate html file just for that peice of code that I can include into all of the pages. How can I do that?

Kinda like a PHP include, but with HTML?
0

#2 User is offline   Lev 

  • -'-
  • PipPipPipPipPip
  • Group: Members
  • Posts: 3,946
  • Joined: 28-October 09
  • Reputation: 258
  • Gender:Male
  • Location:Russia
  • Experience:Advanced
  • Area of Expertise:Web Designer

Posted 09 January 2010 - 08:51 PM

SSI maybe?
0

#3 User is offline   CBG 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 164
  • Joined: 21-February 09
  • Reputation: 0
  • Location:England, UK
  • Experience:Intermediate
  • Area of Expertise:Video Production

Posted 09 January 2010 - 09:01 PM

View PostLev, on 09 January 2010 - 08:51 PM, said:

SSI maybe?


Cool so if I add <!--#include virtual="filewithcodein.html" --> to my code it'll add the contents of the file into my page?
0

#4 User is offline   Wickham 

  • Web Guru
  • View gallery
  • Group: Moderators
  • Posts: 2,875
  • Joined: 11-June 09
  • Reputation: 257
  • Gender:Male
  • Location:Salisbury UK
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 09 January 2010 - 09:08 PM

I don't think you can do it with a page that has .html extension, but you can with .shtml extension or .php extension.

PHP is the best method, why not use that; (check that your host supports PHP).

SHTML and PHP examples:- http://www.wickham43...eincludes.shtml
0

#5 User is offline   CBG 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 164
  • Joined: 21-February 09
  • Reputation: 0
  • Location:England, UK
  • Experience:Intermediate
  • Area of Expertise:Video Production

Posted 09 January 2010 - 09:10 PM

View PostWickham, on 09 January 2010 - 09:08 PM, said:

I don't think you can do it with a page that has .html extension, but you can with .shtml extension or .php extension.

PHP is the best method, why not use that; (check that your host supports PHP).

SHTML and PHP examples:- http://www.wickham43...eincludes.shtml


Ahh yes, I will do it with a PHP include, thankyou!
0

#6 User is offline   CBG 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 164
  • Joined: 21-February 09
  • Reputation: 0
  • Location:England, UK
  • Experience:Intermediate
  • Area of Expertise:Video Production

Posted 09 January 2010 - 09:36 PM

View PostCBG, on 09 January 2010 - 09:10 PM, said:

Ahh yes, I will do it with a PHP include, thankyou!


Got it working in the site, thanks!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users