Jump to content


Photo

What is daily include missing?


  • Please log in to reply
3 replies to this topic

#1 11Tami

11Tami
  • Members
  • PipPipPip
  • Advanced Member
  • 329 posts

Posted 22 September 2006 - 08:44 PM

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]);}
?>



#2 freakus_maximus

freakus_maximus
  • Members
  • PipPipPip
  • Advanced Member
  • 177 posts

Posted 22 September 2006 - 09:00 PM

Looks like your missing your first curly brace:

if (isset($content[$date]) {

include($content[$date]);

}


#3 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 22 September 2006 - 09:10 PM

You could shorten up the array code a bit:

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

$date = date('d');
include($content[$date]);
?>
Don't think you need the if(isset(  part though                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

#4 11Tami

11Tami
  • Members
  • PipPipPip
  • Advanced Member
  • 329 posts

Posted 22 September 2006 - 10:38 PM

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]);

?>








0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users