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
https://forums.phpfreaks.com/topic/21716-what-is-daily-include-missing/
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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
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]);

?>



Archived

This topic is now archived and is closed to further replies.

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