Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Sep 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Editing text of multiple pages from one source?

    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?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    Is this possible?
    Yes! Make a single file page with your words and use a serverside script like PHP to inlude() this file in the required pages.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    614
    Thanks
    48
    Thanked 64 Times in 64 Posts
    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.
    "Yeah science!"
    Online Science Tools

  • #4
    Regular Coder optimus203's Avatar
    Join Date
    Sep 2008
    Location
    CT
    Posts
    317
    Thanks
    22
    Thanked 16 Times in 15 Posts
    Quote Originally Posted by abduraooft View Post
    Yes! Make a single file page with your words and use a serverside script like PHP to inlude() this file in the required pages.
    Sounds like PHP is your best bet. A correction to abdura's link (small typo): include().
    Always thank those CF Users who help you solve issues...
    Connecticut Web Design


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •