Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Include a file

Reply
Thread Tools

Include a file

 
 
Tony Wainwright
Guest
Posts: n/a
 
      02-22-2006
Hi
I am teaching myself how to develop websites for my own benefit and have
come across something that I don't know how to do. I want to be able to
include in every page a file that contains information that will be
displayed on every page i.e. copyright info. I don't want to have to
re-write every page when I change this information - I just want to be able
to edit it once. I know it can be done in PHP (as shown below), but I want
to be able to do it in HTML.
<?php
include_once ('includes/copyright.html');
?>
Is this possible?

Thanks
Tony


 
Reply With Quote
 
 
 
 
Dylan Parry
Guest
Posts: n/a
 
      02-22-2006
Pondering the eternal question of "Hobnobs or Rich Tea?", Tony
Wainwright finally proclaimed:

> I know it can be done in PHP (as shown below), but I want
> to be able to do it in HTML.
> <?php
> include_once ('includes/copyright.html');
> ?>
> Is this possible?


In HTML alone, not really. You could use inline frames, but that would
be a particularly bad idea. Is there any particular reason why you
/can't/ use PHP for this?

--
Dylan Parry
http://webpageworkshop.co.uk -- FREE Web tutorials and references

Listening to: Brahms - Symphony No. 2 in D major, op
 
Reply With Quote
 
 
 
 
Tony Wainwright
Guest
Posts: n/a
 
      02-22-2006
No particular reason why, I just wondered
Tony
"Dylan Parry" <(E-Mail Removed)> wrote in message
news:18xryynaisa7y$(E-Mail Removed)...
> Pondering the eternal question of "Hobnobs or Rich Tea?", Tony
> Wainwright finally proclaimed:
>
>> I know it can be done in PHP (as shown below), but I want
>> to be able to do it in HTML.
>> <?php
>> include_once ('includes/copyright.html');
>> ?>
>> Is this possible?

>
> In HTML alone, not really. You could use inline frames, but that would
> be a particularly bad idea. Is there any particular reason why you
> /can't/ use PHP for this?
>
> --
> Dylan Parry
> http://webpageworkshop.co.uk -- FREE Web tutorials and references
>
> Listening to: Brahms - Symphony No. 2 in D major, op



 
Reply With Quote
 
Dylan Parry
Guest
Posts: n/a
 
      02-22-2006
Pondering the eternal question of "Hobnobs or Rich Tea?", Tony
Wainwright finally proclaimed:

> No particular reason why, I just wondered


Please don't top-post

Well if the reason was just wondering, then that's okay! Really the best
way to attempt to include a file is on the server-side rather than
relying on the client's machine to do the work. I'd stick to using PHP
for it as it's much more reliable.

--
Dylan Parry
http://webpageworkshop.co.uk -- FREE Web tutorials and references

Listening to: Brahms - Symphony No. 2 in D major, op. 73
 
Reply With Quote
 
David Segall
Guest
Posts: n/a
 
      02-22-2006
"Tony Wainwright" <(E-Mail Removed)> wrote:

>Hi
>I am teaching myself how to develop websites for my own benefit and have
>come across something that I don't know how to do. I want to be able to
>include in every page a file that contains information that will be
>displayed on every page i.e. copyright info. I don't want to have to
>re-write every page when I change this information - I just want to be able
>to edit it once. I know it can be done in PHP (as shown below), but I want
>to be able to do it in HTML.
><?php
> include_once ('includes/copyright.html');
>?>
>Is this possible?

I don't think so but you may want to consider a preprocessor that
expands the includes and other macros before you upload the HTML. A
Google for HTML preprocessor yields many of them.
 
Reply With Quote
 
Stan McCann
Guest
Posts: n/a
 
      02-22-2006
"Tony Wainwright" <(E-Mail Removed)> wrote in
news:dtheqd$gq1$(E-Mail Removed)-infra.bt.com:

> Hi
> I am teaching myself how to develop websites for my own benefit and
> have come across something that I don't know how to do. I want to
> be able to include in every page a file that contains information
> that will be displayed on every page i.e. copyright info. I don't
> want to have to re-write every page when I change this information -
> I just want to be able to edit it once. I know it can be done in PHP
> (as shown below), but I want to be able to do it in HTML.
> <?php
> include_once ('includes/copyright.html');
> ?>
> Is this possible?


If your sever supports SSI, then:
<!--#include virtual="includes/copyright.html" -->

If you are going to try instead of ask, some installations use the
Xbithack which requires the file including others to have the x bit
set.

--
Stan McCann, "Uncle Pirate" http://stanmccann.us/
Webmaster, NMSU at Alamogordo http://alamo.nmsu.edu/
Now blocking Google Grouper posts and replies.
http://blinkynet.net/comp/uip5.html
 
Reply With Quote
 
Tha RagMan
Guest
Posts: n/a
 
      02-22-2006
On Wed, 22 Feb 2006 10:35:58 +0000 (UTC), "Tony Wainwright"
<(E-Mail Removed)> wrote:

>Hi
>I am teaching myself how to develop websites for my own benefit and have
>come across something that I don't know how to do. I want to be able to
>include in every page a file that contains information that will be
>displayed on every page i.e. copyright info. I don't want to have to
>re-write every page when I change this information - I just want to be able
>to edit it once. I know it can be done in PHP (as shown below), but I want
>to be able to do it in HTML.
><?php


Have you considered SSI ? Take a look at this site for info on how:
http://www.smartwebby.com/web_site_d...e_includes.asp
Best of luck.
Tha RagMan
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/* #include <someyhing.h> */ => include it or do not include it?That is the question .... Andreas Bogenberger C Programming 3 02-22-2008 10:53 AM
ASP Include file error <!-- #include file="" --> naveeddil ASP .Net 0 01-04-2008 12:58 PM
include file in include file PTM HTML 1 11-12-2007 10:13 AM
ASP Error 0126 include file not found, when using ".." in include file path Eric ASP General 10 01-11-2007 07:38 AM
#include "file" -vs- #include <file> Victor Bazarov C++ 4 03-06-2005 07:09 PM



Advertisments