...

View Full Version : Editing text of multiple pages from one source?



Clayton91
10-30-2010, 10:55 AM
Hi everyone.
Is it possible to edit a piece of text that will show up on many pages of a site, all from one source?

For example:
Let's say that my website has a total of 10 pages. I want to have the text, "Latest Score: 3-0"
appear in the same place, on each one of those pages.
Instead of manually editing the html file of all 10 pages every time the score changes, is it possible to only edit the html file of 1 page, and have all 10 pages change.
So, in this example, I'd change (on only one html file) the text above to,
"Latest Score: 3-1"
and as a result, the new text would be shown on all 10 pages.

Is this possible?

If not possible with html, is it possible with javascript?

abduraooft
10-30-2010, 11:36 AM
Is this possible? Yes! Make a single file page with your words and use a serverside script like PHP to inlude() (http://php.net/inlude) this file in the required pages.

djh101
10-30-2010, 01:39 PM
It is possible with Javascript. As ^ said, though, server side scripting is the better way to go. If your host supports PHP (which most do, save Windows hosts), save your files with a .php extension, put the data you want to include in a separate file (.html or .php), and add in <?php include(myfile.html); ?> wherever you want to include said file. The url must point directly to the file you want. I was doing this for a while before I actually learned and started using PHP any further.

optimus203
11-16-2010, 02:24 AM
Yes! Make a single file page with your words and use a serverside script like PHP to inlude() (http://php.net/inlude) this file in the required pages.

Sounds like PHP is your best bet. A correction to abdura's link (small typo): include() (http://us3.php.net/manual/en/function.include.php).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum