• Using SSI For Auto Updates

    Date: 2011.02.24 | Category: WebDesign | Tags:

    We all realize the benefits of being able to save time when building sites so, I got into thinking, how can I make my sites look as if they are continually updated without the need to go in and update them manually? Enter the world of SSI.

    SSI is actually a nifty little tool, not only can you include files from a central location but, you can include them at specific times of the day, days of the week or even months of the year, very handy indeed if you are building any type of site that needs updating periodically.

    Once the main burst of work has been completed you can pretty much use the same files over and over again to help you out.

    So onto the auto updating SSI, the following SSI coding will enable you to update a page or pages based on which day of the month it is. It will check the day the page has been accessed and display the relevant information again, this is a handy thing to have should your sponsor be running a promotion over several days, all you need to do is update a selection of SSI files and all of your sites are updated instantly.

    <!–#config timefmt=”%d”–>
    <!–#include virtual=”/yourdirectory/$DATE_LOCAL.txt”–>

    What you need to do is create 31 text files named 01.txt right the way through to 31.txt take the SSI call above and edit the location of the SSI files on your server, you may like to have a central folder named /SSI/ for this purpose so the location would be changed to /domain.com/SSI/$DATE_LOCAL.txt

    I the 31 files you created you could have a table ad with eight of your sponsors links, an article in each one or even just a simple text link, anything that you may want to update can be included in these files.

    As I mentioned above you can base the time, date and even month of rotation to whatever you like to alter how the files are rotated and ultimately viewed on the web you should change the %d in the timefmt field to one of the following:

    %d : Day of the month requires 31 files named 01.txt to 31.txt
    %w : Day of the week requires 7 files named 0.txt to 6.txt
    %j : Day of the year requires 365 files named 001.txt to 365.txt
    %u : The week of the year requires 52 files named 00.txt to 53.txt
    %m : The month of the year requires 12 files named 01.txt to 12.txt
    %H : Hour of the day requires 24 files named 00.txt to 23.txt
    %M : Minute of the hour requires 60 files named 00.txt to 59.txt

    As you can see from the above there really are no limitations to the uses of updating using SSI and, apart fro the relative ease of use and the time saved using them should one sponsor not be converting for you all you need to do to swap sponsors is alter your central set of SSI files and you have instantly changed sponsors over all of your sites.

    Article written by Lee