You are here: Re: How to display the same links in every page? « HTML « IT news, forums, messages
Re: How to display the same links in every page?

Posted by JAF on 08/30/06 14:01

On 28 Aug 2006 16:03:22 -0700, fraternitydisposal@gmail.com wrote:

snip...
>My webhost doesn't support server side scripting. Can i store the links
>in an external file and insert them by client side scripting? Please
>help.

I tried several ways to do this. The way I settled on is to use php.
If your web hosting company allows php, I would suggest using it.

It is easy to learn, and once you have learned php, you will start to
think of many ways to reuse code.

For example, I use the "include" statement in php to insert code into
multiple html files, specifically, I insert the html code for

key words

navigation links
- top nav links
- left nav links
- bottom nav links
- etc

header sections

footer sections

copyrights

ads


Here is a brief example:

let's say you html file is something like this

line of code 1

line of code 2

line of code 3

line of code 4

line of code 5

line of code 6

If you want to reuse lines 3, 4, and 5, you would have a file that
reads


line of code 1

line of code 2

<? include "php_file.txt"; ?>

line of code 6


And you "php_file.txt" would contain

line of code 3

line of code 4

line of code 5

The include would insert the code right into the line where the
include is.

Another example:

I created this text file that I call "copyright.txt". Here is the
code:

<p align="center">Copyright © 1995-2006 BSC,
Inc.&nbsp; All rights reserved.&nbsp;&nbsp;
<a href="http://www.bscinc.net/contact_us.php">Click Here To
Contact Us</a> with questions or comments about this web site.</p>

And I put this include line at the appropriate spot at the bottom of
every html page:

<? include $phpdir . "copyright.txt"; ?>

When my page is served by the web hosting server, the include reads in
and inserts the html code in the text file.

I love php. It is worth learning because you can learn little pieces
at a time and reap great rewards, i.e. savings in time. But you can
go on to learn much more complicated aspects of php, like the use of
variables and conditional programming, to do some very nice things
with it.

Php works well for the casual programmer and the expert.

The only catch is your web hosting company has to offer it. Most I
have found do.
Best regards,

JAF
http://www.bscinc.net
http://www.affordablefloridainsurance.com
http://www.discountdrivingschool.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация