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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How can I cycle .html files, for it to show one .html file a week?

    Hi there,

    I am fairly new to the language PHP. I have been searching, and writing trying to get this script to work for about two weeks now to no prevail, and thats why I am asking you now. I started writing this script in Javascript, but I soon found out you cannot do SSI's.

    Here is what I have so far, and hopefully it can give you an idea of what I want from it:

    --------------------

    <?php

    $week = date(W)
    $weekfile = array("class23.html","class456.html"...);


    include($weekfile['$week']);

    ?>

    --------------------

    Now I am trying to take that script, and make it to where it includes a new .html file each Sunday. If not Sunday then Monday wouldn't be half bad either.

    But any help is much appreciated, and if your having trouble understanding my question just ask me to elaborate a little more, and I'll do my best. Thanks for any help you can provide!

  • #2
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    you're nearly there,
    PHP Code:
    $week date('W');

    $file_index $week 1//because weeks start at 1, arrays start at 0

    $files = array('file1.html','file2.html'); //etc.

    $week_file $files[$file_index];

    include 
    $week_file
    My thoughts on some things: http://codemeetsmusic.com
    And my scrapbook of cool things: http://gjones.tumblr.com

  • #3
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Wow, thank you so much. That script worked like a charm. I knew it had to be something simple like that, but I couldn't ever find what that simple thing was. But thank you so much!


  •  

    Posting Permissions

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