Why am I getting these notices? I haven't before. Undefined offset / index for a custom calendar class. |
[eluser]Kinsbane[/eluser]
Hi folks, Recently my work bought a new webserver with the latest LAMP setup. Our current server is PHP4, and this one is PHP 5.2.x. Not sure if this is related or not, but I was hoping I could get some troubleshooting assistance so my log files with CodeIgniter don't fill up with thousands of PHP Notice Errors. So, here's the stuff that grabs the events for the current month: Code: //***** INSIDE Events controller I have uploaded the CI Library I have here: http://www.kinsbane.net/temp/ci-class.dccalendar.txt Was hoping someone could take a look and help me figure out why I'm getting a whole bunch of these Undefined offset errors. Here's a sample of the final array that the class works with. The $array[$date][$x][0] is the link to the event in the calendar, [1] is its current status, [2] is the name of the event, and [3] is the color assigned to the event in the calendar. Funnily enough, the undefined offset errors are because of the timestamps being used as indexes but I guess they get seen as offsets? Code: Array Here's a sample of what it looks like: http://www.kinsbane.net/temp/calendar-sample.jpg
[eluser]Kinsbane[/eluser]
A pre-emptive big "THANK YOU!" to whoever can help out.
[eluser]TheFuzzy0ne[/eluser]
http://www.kinsbane.net/temp/calendar-sample.php = page not found. It would really help to know what line number is causing the error, as well as where that line is in your code.
[eluser]xwero[/eluser]
in the array you copied here i see some indexes start with 1 Code: [1236153600] => Array
[eluser]Kinsbane[/eluser]
[quote author="TheFuzzy0ne" date="1237245815"]http://www.kinsbane.net/temp/calendar-sample.php = page not found. It would really help to know what line number is causing the error, as well as where that line is in your code.[/quote] Sorry about that, I changed the link, it should be calendar-sample.jpg! The actual errors I'm getting are as follows: Code: A PHP Error was encountered etc.. etc...
[eluser]Kinsbane[/eluser]
[quote author="xwero" date="1237246226"]in the array you copied here i see some indexes start with 1 Code: [1236153600] => Array The reason for that is so when the HTML part is written, when it writes the events for the day inside the table cell, it keeps all the events on the same line. Say you have an event that is for the 5th and 6th, and another event for the 6th and 7th - when it gets to the 7th, the program knows that it needs to make space for the event that came before it, so in the days that come after one that had an event, it adjusts that particular index to make space. If you look at http://www.kinsbane.net/temp/calendar-sample.jpg you'll see. The structure of the array is as follows: $array[*date*] (each day of the month gets an array) $array[*date*][*position*] (for each event in a day, this determines the events position, from top (0) to bottom ( > 0 ) within that day) $array[*date*][*position*][*event-info*] (each event has an array of info to link to the event display page, the title, the event's status, and the unique color that event block link should be)
[eluser]TheFuzzy0ne[/eluser]
I still need to know which line of your code is line number 345. EDIT: Err... scrap that. I forgot about the links you posted.
[eluser]Kinsbane[/eluser]
At least, I think that's why it does that... I didn't write the original class, this was pretty much a copy/paste for use with CI since I couldn't get assistance with modifying CI's class to allow for events that span multiple days and keep the same formatting as the class that I have now. I've always had trouble mapping out the data flow with this class, and now I'm literally at a brick wall because I just can't figure out why it would tell me these are undefined offsets NOW, as opposed to when this was used on a PHP4 system. Maybe just cause it wasn't reporting E_NOTICE??
[eluser]pistolPete[/eluser]
Did you remove some comment at the beginning of the file? I don't see any array in line 169 or 345... |
Welcome Guest, Not a member yet? Register Sign In |