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 8 of 8
  1. #1
    Regular Coder Kevin_M_Schafer's Avatar
    Join Date
    Apr 2011
    Location
    Fairfax, Minnesota, U.S.A.
    Posts
    482
    Thanks
    97
    Thanked 17 Times in 17 Posts

    Adding a piece of text to all web pages using code

    I need to have a disclaimer at the bottom of my pages that has the year 2011 in it for copyright. The year needs to be updated each year, even though the content stays the same.

    Is there a way to apply a few lines of text to a web page by using a piece of code that would pull the text from a single file or folder so that when I update the year, it changes on all of the pages?

    I could very easily have 500 or more pages a year, and it would take a long time to update all of them each January.

    Thanks,

  • #2
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,338
    Thanks
    5
    Thanked 363 Times in 360 Posts
    WHy not create the footer separately and use a server side include. That way when you need to update the copyright code, you do it once and all 500 pages get updated. Just like a css file. Change one style and all pages that are linked to that stylesheet reflect the change.

    PHP, Coldfusion, and I'm sure most of the others have this functionality.
    Teed

  • Users who have thanked teedoff for this post:

    Kevin_M_Schafer (04-23-2011)

  • #3
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,661
    Thanks
    6
    Thanked 1,006 Times in 979 Posts
    Yeah, to clarify: Search the internet for “server side include” (SSI) or “PHP include” (for the two most popular ones).

  • Users who have thanked VIPStephan for this post:

    Kevin_M_Schafer (04-23-2011)

  • #4
    Registered User
    Join Date
    Feb 2011
    Posts
    82
    Thanks
    15
    Thanked 3 Times in 3 Posts
    <?php include "filename.html" ?>

  • Users who have thanked Aurora.Light for this post:

    Kevin_M_Schafer (04-23-2011)

  • #5
    Regular Coder Kevin_M_Schafer's Avatar
    Join Date
    Apr 2011
    Location
    Fairfax, Minnesota, U.S.A.
    Posts
    482
    Thanks
    97
    Thanked 17 Times in 17 Posts
    It worked!

    I went with

    <!--#include virtual="/ssiads/pageads.shtml" -->

    and

    <!--#include virtual="/ssi/teecopyright.shtml" -->

    both on the same page. This is really slick!

    I needed to read up on it to understand "file" and "virtual," but I got it.

    Thanks, teedoff and VIPStephan. I appreciate your help!

    Aurora.Light, do you recommend the php over the <!--#include . . . code?

    I appreciate any imput.

  • #6
    Regular Coder Kevin_M_Schafer's Avatar
    Join Date
    Apr 2011
    Location
    Fairfax, Minnesota, U.S.A.
    Posts
    482
    Thanks
    97
    Thanked 17 Times in 17 Posts
    I have another question. My site is just getting cranked up, so going back and adding the "includes" code on 30 pages isn't a problem, but is there a downside to having .shtml pages instead of .html pages?

    I'll make all my pages .shtml to accommodate the "includes" code, but is this ill-advised?

    Any input will be greatly appreciated.

  • #7
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,661
    Thanks
    6
    Thanked 1,006 Times in 979 Posts
    There’s no difference in using PHP or SSI except of the “language” used. In the end the page (and source code) looks the same as if it was static HTML. Also, the file extensions have no effect whatsoever on page ranking, rendering of code, or SEO. It’s just so that the server knows what to expect (i. e. static HTML or HTML with SSI). In fact, with some htaccess rules or server configuration you can have any extension you like (or even no extension at all).

    However, for SEO you should note that changing page/file names that are already indexed in search engines from .html to .shtml (or anything else) you should put a 301 (permanent) redirect from the old file to the new one so that people won’t get a 404 error and search engines know that the page has moved.

  • Users who have thanked VIPStephan for this post:

    Kevin_M_Schafer (04-23-2011)

  • #8
    Regular Coder Kevin_M_Schafer's Avatar
    Join Date
    Apr 2011
    Location
    Fairfax, Minnesota, U.S.A.
    Posts
    482
    Thanks
    97
    Thanked 17 Times in 17 Posts
    Thanks, VIPStephan.

    I appreciate you time and explanation.

    --Kevin


  •  

    Posting Permissions

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