Jump to content

Php Help please


Recommended Posts

Hi,

I am trying to do a simple page which will display a different Javascript Jigsaw every day. The code i have been using is the following. :-

 

<?php

// create an array with the files you wish to use in

$dirarray[1] = "day1.html";

$dirarray[2] = "day2.html";

$dirarray[3] = "day3.html";

$dirarray[4] = "day4.html";

$dirarray[5] = "day5.html";

$dirarray[6] = "day6.html";

$dirarray[7] = "day7.html";

$dirarray[8] = "day8.html";

$dirarray[9] = "day9.html";

$dirarray[10] = "day10.html";

$dirarray[11] = "day11.html";

$dirarray[12] = "day12.html";

$dirarray[13] = "day13.html";

$dirarray[14] = "day14.html";

$dirarray[15] = "day15.html";

$dirarray[16] = "day16.html";

$dirarray[17] = "day17.html";

$dirarray[18] = "day18.html";

$dirarray[19] = "day19.html";

$dirarray[20] = "day20.html";

$dirarray[21] = "day21.html";

$dirarray[22] = "day22.html";

$dirarray[23] = "day23.html";

$dirarray[24] = "day24.html";

$dirarray[25] = "day25.html";

$dirarray[26] = "day26.html";

$dirarray[27] = "day27.html";

$dirarray[28] = "day28.html";

$dirarray[29] = "day29.html";

$dirarray[30] = "day30.html";

$dirarray[31] = "day31.html";

 

// copy the element in the array corresponding to today's date

if (!copy($dirarray[date], "../index.html")) {

  echo "failed to copy...\n";

}

?>

 

 

 

The effect iam after is the Jigsaw will appear on the page...ie 1sr December will be a partridge as in 1st day of christmas, then the 2nd december will be Jigsaw of 2 turtle doves etc etc. I have the script to install for the jigsaws and have the html pages dated from day1.html to day31.html as listed in the code above, but no idea where to put the code above so that is will display the day1.html on the 1st and day2.html on the 2nd etc. I have them in a directory called advent with 2 folders one named index.html (which is a blank page) and the file with the above code i have in advent.php, but also tried it at index.php Hope i am making sense, I am a complete novice when it comes to php, and have been trying to make this script work for the last 9 hours. So if anyone can please help me i would be very greatful

 

Many thanks

 

Mic

Link to comment
Share on other sites

  • 4 weeks later...

@bridlodian

 

Your above code needs to be requested by someone before it will actually work. The server either serves an index.html or an index.php, but not both. Any dynamic code must be placed in a php file, which means your index.html will never be reached anyway.

Do what the previous post said, redirect by placing that code in your index.php.

Alternatively just include the correct page in your index.php, depending on the date.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.