Jump to content

rajivgonsalves

Members
  • Posts

    2,166
  • Joined

  • Last visited

    Never

About rajivgonsalves

  • Birthday 07/31/1979

Contact Methods

  • MSN
    rajivgonsalves@hotmail.com
  • Website URL
    http://www.rajivgonsalves.com
  • Yahoo
    rajivgonsalves

Profile Information

  • Gender
    Male
  • Location
    Pune, India

rajivgonsalves's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Your not doing anything wrong there was a bug in the code new code below <?php function dynamicinclude($filename,$strDate,$intMax) { $intTime = strtotime($strDate); $intToday = time(); $intDifference = $intToday-$intTime; $intWeek = floor($intDifference/(86400*7)); $intCounter = $intWeek%$intMax+1; $strFilename = $filename.$intCounter.".php"; include("../includes/songs/".$strFilename); } dynamicinclude("song","2007-11-20",3); ?> lemme know if you face any problems
  2. Yes you just give a start date parameter two, if you have more files than 70 change the last parameter, so say you got 100 files put 100 there it will rotate, if your putting it in some folder just change the include statement from include($strFilename); to include("includes/".$strFilename); if all files are residing in the include folder. hope it helpful
  3. here I wrote you something <?php function dynamicinclude($filename,$strDate,$intMax) { $intTime = strtotime($strDate); $intToday = time(); $intDifference = $intToday-$intTime; $intWeek = ceil($intDifference/(86400*7)); $strFilename = $filename.($intWeek%$intMax).".php"; include($strFilename); } dynamicinclude("file","2007-12-10",70); ?> Param1 = "file" is the string so basically it will be file1.php and so on you can change it to something else Param2 = start date of the include Param3 = max number of include file so it will rotate hope its helpful
  4. currently we are running in the 50 week of the year so it will file50.php once we cross next week it will include file51.php and onwards however you can write a better include system based on a give date so that you give a date from that date until 7 days it will include file1.php...
  5. You can do <?php include("file".date("W").".php"); ?> but as per my knowlegde I think there are 52 weeks in a year
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.