Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Avoiding Duplicating Code

Reply
Thread Tools

Avoiding Duplicating Code

 
 
Robb
Guest
Posts: n/a
 
      11-14-2006
My header (images and a couple links), main menu, and footer are the same on all pages. Can they be
put into an external file instead of duplicated on every page?

Thanks,
Robb

 
Reply With Quote
 
 
 
 
Nico Schuyt
Guest
Posts: n/a
 
      11-14-2006
Robb wrote:
> My header (images and a couple links), main menu, and footer are the
> same on all pages. Can they be put into an external file instead of
> duplicated on every page?


http://allmyfaqs.net/faq.pl?Include_one_file_in_another

--
Nico Schuyt
http://www.nicoschuyt.nl/


 
Reply With Quote
 
 
 
 
password
Guest
Posts: n/a
 
      11-14-2006

"Robb" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> My header (images and a couple links), main menu, and footer are the same

on all pages. Can they be
> put into an external file instead of duplicated on every page?
>

php and includes

make main content bit a php file
make your header menu etc a separate html file
make footer a separate html file

then at top and bottom of php page do

<?php
include('whereeveritis/header.html');
?>

php content stuff goes here
<?php
include('whereeveritis/footer.html');
?>

'whereveritis' is the route to the html files
you may have to fiddle with route to your css because the 'includes' think
(behave as if) they are where the php page is located even if they are in a
different folder

i hope that is clear


 
Reply With Quote
 
Robb
Guest
Posts: n/a
 
      11-16-2006
Thanks, I'll give this a try.


On Tue, 14 Nov 2006 23:31:45 -0000, "password" <(E-Mail Removed)> wrote:

>
>"Robb" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed).. .
>> My header (images and a couple links), main menu, and footer are the same

>on all pages. Can they be
>> put into an external file instead of duplicated on every page?
>>

>php and includes
>
>make main content bit a php file
>make your header menu etc a separate html file
>make footer a separate html file
>
>then at top and bottom of php page do
>
><?php
>include('whereeveritis/header.html');
>?>
>
>php content stuff goes here
><?php
>include('whereeveritis/footer.html');
>?>
>
>'whereveritis' is the route to the html files
>you may have to fiddle with route to your css because the 'includes' think
>(behave as if) they are where the php page is located even if they are in a
>different folder
>
>i hope that is clear
>


 
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
Avoiding code repetition - same code but different hashes Aldric Giacomoni Ruby 1 02-19-2009 09:12 PM
ASP.Net Duplicating DB Entries Todd Plambeck ASP .Net 2 08-05-2005 07:55 PM
Duplicating datasheet screens Don ASP .Net 0 02-23-2005 03:09 AM
log4j duplicating appender entries George Jempty Java 2 01-15-2005 06:09 AM
Forms authentication duplicating ReturnURL AC ASP .Net 0 07-27-2004 02:10 PM



Advertisments