Results 1 to 7 of 7
  1. #1
    All Around Web Guy Cursal's Avatar
    Join Date
    January 18th, 2005
    Posts
    829
    inserting php in ssi
    I am trying to add php code to my ssi footer so the copyright will update yearly without me having to go in and change it manually.

    If I only had one site this would be no problem, but that isn't the case.

    Anybody done this before?

    Note* I am trying to this with pages ending in .shtml

    I thought about adding adhandles in apache to parse the .shtml pages to read as .php pages then just adding

    <?
    echo "Copyright &copy; 2002-".date('Y');
    ?>

    but some sites have .php .shtml .html page extentions and I'm not sure how that would effect the other pages in the site.

    Any ideas or examples would be great!

    I tried pulling php into my ssi docs, that didn't work.

    eager tolearn how to do this,
    --Brian
    Oregon Publishing: Web Development, Graphic Design, Domains & Marketing
    Deluxe Banners Bartender's Guide Cooking Jobs

  2. #2
    Animal Lover
    Join Date
    January 18th, 2005
    Location
    oz
    Posts
    1,210
    Put that bit of php code in another file and call it copyright.php (or whatever) then call it as you would any SSI ie

    <!--#include virtual="copyright.php" -->

    it should work - then you can avoid fiddling with the htaccess file...

    Oscar
    My DataFeed Scripts - php datafeed scripts for your site
    Shareasale datafeed scripts - to display Shareasale datafeeds
    Linkshare datafeed scripts - for multiple Linkshare merchants

  3. #3
    All Around Web Guy Cursal's Avatar
    Join Date
    January 18th, 2005
    Posts
    829
    tried that earlier and it didn't work.

    Tried it again just now and Wham-O

    it worked

    Thanks Oscar

    guess I was doing something wrong before, but after a bit of a break, and fresh eyes, it worked.
    Oregon Publishing: Web Development, Graphic Design, Domains & Marketing
    Deluxe Banners Bartender's Guide Cooking Jobs

  4. #4
    Animal Lover
    Join Date
    January 18th, 2005
    Location
    oz
    Posts
    1,210
    tried that earlier and it didn't work. Tried it again just now and Wham-O
    Gets like that when you're looking at code for too long...all those quotes and semi-colons become a bit of a blur...

    Oscar
    My DataFeed Scripts - php datafeed scripts for your site
    Shareasale datafeed scripts - to display Shareasale datafeeds
    Linkshare datafeed scripts - for multiple Linkshare merchants

  5. #5
    All Around Web Guy Cursal's Avatar
    Join Date
    January 18th, 2005
    Posts
    829
    Gets like that when you're looking at code for too long...all those quotes and semi-colons become a bit of a blur...
    you said it brother
    Oregon Publishing: Web Development, Graphic Design, Domains & Marketing
    Deluxe Banners Bartender's Guide Cooking Jobs

  6. #6
    Affiliate Manager
    Join Date
    January 18th, 2005
    Posts
    1,056
    This is what I do:

    Put this in the copyright.php file:
    PHP Code:
    <? echo date("Y"); ?>
    Then in your webpage to call it:

    Code:
    Copyright &copy; 2002 - <!--#include virtual="copyright.php" -->
    Much easier and cleaner

  7. #7
    All Around Web Guy Cursal's Avatar
    Join Date
    January 18th, 2005
    Posts
    829
    Thanks Chet_B

    I have finally mustered up the courage to pick up my php for dummies book again and am working through it.....s l o w l y.... new and old sites need a face lift "behind the scene"

    Agreed your code is cleaner and is being used

    Thank you both :tup:

    note to oscar* I was trying to get around the search&replace of all the includes and reuploading 1,000s of pages, but what has to be done is now done. And easier to manage. Well, this part it really doesn't need much management anymore, let the code work for me
    Oregon Publishing: Web Development, Graphic Design, Domains & Marketing
    Deluxe Banners Bartender's Guide Cooking Jobs

  8. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Inserting Affiliate ID into Link using PHP script
    By writerguy in forum Programming / Datafeeds / Tools
    Replies: 17
    Last Post: May 21st, 2010, 10:26 AM
  2. Replies: 26
    Last Post: November 14th, 2007, 11:08 PM
  3. Inserting text into db
    By jackson992 in forum Programming / Datafeeds / Tools
    Replies: 2
    Last Post: December 19th, 2005, 10:12 PM
  4. SSI & PHP
    By Wayder in forum Programming / Datafeeds / Tools
    Replies: 7
    Last Post: January 24th, 2003, 07:40 PM
  5. SSI Includes and PHP
    By jimbet7 in forum Programming / Datafeeds / Tools
    Replies: 2
    Last Post: September 4th, 2002, 10:20 AM

Posting Permissions

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