Jump to content

What is daily include missing?


11Tami

Recommended Posts

Hello, I don't know whats wrong with this code. Its supposed to
include a new web site url daily. Since its a web site url it won't be in the same directory, it will just be calling the url address online.
Thank you!!! Tami

<?php

$content = array();
$content["01"] = "day1.htm";
$content["02"] = "day2.htm";
$content["03"] = "day3.htm";
$content["04"] = "day4.htm";
$content["05"] = "day5.htm";
$content["06"] = "day6.htm";
$content["07"] = "day7.htm";
$content["08"] = "day8.htm";
$content["09"] = "day9.htm";
$content["10"] = "day10.htm";
$content["11"] = "day11.htm";
$content["12"] = "day12.htm";
$content["13"] = "day13.htm";
$content["14"] = "day14.htm";
$content["15"] = "day15.htm";
$content["16"] = "day16.htm";
$content["17"] = "day17.htm";
$content["18"] = "day18.htm";
$content["19"] = "day19.htm";
$content["20"] = "http://www.website.com";
$content["21"] = "day20.htm";
$content["22"] = "day21.htm";
$content["23"] = "day23.htm";
$content["22"] = "day23.htm";
$content["24"] = "day24.htm";
$content["25"] = "day25.htm";
$content["26"] = "day26.htm";
$content["27"] = "day27.htm";
$content["28"] = "day28.htm";
$content["29"] = "day29.htm";
$content["30"] = "day30.htm";
$content["31"] = "day31.htm";

$date = date('d');
if (isset($content[$date]) include($content[$date]);}
?>

Link to comment
Share on other sites

You could shorten up the array code a bit:

[code]
<?php
$content = array(1 => "day1.htm", "day2.htm", "day3.html".....etc);

$date = date('d');
include($content[$date]);
?>
[/code]
Don't think you need the if(isset(  part though                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
Link to comment
Share on other sites

The error message I am getting says it can't open the url that I put on line 22 for today's date. I try using real url's not the ones below. It gives me the correct address for it, but it won't open it. It says suitable wrapper can't be found even though my include command works fine, otherwise it wouldn't bring up slot 22's web address.

I've tackled php include commands and now know how to do it really well, so there is still something wrong with the script. PS. I changed it to this in my php. $date = date('d');
include($content[$date]);

Any ideas? I notice this has no brackets surrounding any commands, does it need any? Thanks

Here is the one I am trying now before I try trimming it down.

<?php

$content = array();
$content["01"] = "day1.htm";
$content["02"] = "day2.htm";
$content["03"] = "day3.htm";
$content["04"] = "day4.htm";
$content["05"] = "day5.htm";
$content["06"] = "day6.htm";
$content["07"] = "day7.htm";
$content["08"] = "day8.htm";
$content["09"] = "day9.htm";
$content["10"] = "day10.htm";
$content["11"] = "day11.htm";
$content["12"] = "day12.htm";
$content["13"] = "day13.htm";
$content["14"] = "day14.htm";
$content["15"] = "day15.htm";
$content["16"] = "day16.htm";
$content["17"] = "day17.htm";
$content["18"] = "day18.htm";
$content["19"] = "day19.htm";
$content["20"] = "http://www.website.com";
$content["21"] = "http://www.website.com";
$content["22"] = "http://www.website.com";
$content["23"] = "http://www.website.com";
$content["24"] = "http://www.website.com";
$content["25"] = "day25.htm";
$content["26"] = "day26.htm";
$content["27"] = "day27.htm";
$content["28"] = "day28.htm";
$content["29"] = "day29.htm";
$content["30"] = "day30.htm";
$content["31"] = "day31.htm";

$date = date('d');
include($content[$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.