Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: Months without events giving an error
erik_1099
Junior Member

Posts: 7
Registered: 3/28/2008
Location: Southern California
Member Is Offline
posted on 4/10/2008 at 07:56 PM Reply With Quote
Months without events giving an error


For months without events, I am getting this error:

Warning: Invalid argument supplied for foreach() in /data/10/0/65/122/880611/user/901742/htdocs/calendar/cl_files/events.php on line 115

I am guessing the code just needs to be modified to deal with the case where there are no events for the month. I am not a php coder however so I do not know how to modify. Here's the relevant chunk of code:
Code:

function read_items($d,$m,$y) {
$d=sprintf('%02.0f',$d);
$m=sprintf('%02.0f',$m);
$y=sprintf('%04.0f',$y);
if($d=='00'){
115> foreach($this->items_map[$y][$m] as $d=>$v){
if(is_array($this->items_map[$y][$m][$d]))
foreach($this->items_map[$y][$m][$d] as $k=>$v)
if(is_numeric($k)){
$this->items[$v]->day=$d;
$res[]=$this->items[$v];
}
else $res[$k] = $v;
}
}else{
if(is_array($this->items_map[$y][$m][$d]))
foreach($this->items_map[$y][$m][$d] as $k=>$v)
if(is_numeric($k)){
$this->items[$v]->day=$d;
$res[]=$this->items[$v];
}
else $res[$k] = $v;
}
if(is_array($res))
uasort($res,array('events','sort_by_day'));
return $res;
}
function sort_by_day($_a,$_b){
$a = $_a->day;
$b = $_b->day;
if ($a == $b) return 0;
return ($a > $b) ? -1 : 1;
}
View User's Profile View All Posts By User U2U Member
erik_1099
Junior Member

Posts: 7
Registered: 3/28/2008
Location: Southern California
Member Is Offline
posted on 4/10/2008 at 09:18 PM Reply With Quote

I ended up suppressing the error message, but if anyone has a suggestion for actually fixing the issue, I'd appreciate it.
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page
Product Demonstrations Live Demos
Free/Trial Script Download Free Download
Product Documentation Documentation
Documentation page
Change Log
Support Forum Support Forum
Order Now ORDER NOW!
Add to Cart
View Cart
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004