Styles2304 Posted June 5, 2009 Share Posted June 5, 2009 I had a calendar full of echos that got rather sloppy so I upgraded to a heredoc to improve readability and upgradability. However, when i did that, the code fell apart. I've done some debugging and have narrowed it down to this chunk right here: if (($i == date("j")) && ($month == date("m")) && ($year == date("Y"))) { $EventEOD .=<<<EOD <td width="110px" height="103px" valign="top" align="center"> <div class="date_header_today"> <font class="days_today">$i</font> </div> EOD; } else { $EventEOD .=<<<EOD <td width="110px" height="103px" valign="top" align="center"> <div class="date_header_today"> <font class="days">$i</font> </div> EOD; } If I remove the if statement and choose one chunk of code or the other to execute, the calendar works fine. It's all in the if statement but i don't see anything wrong. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/161063-solved-heredoc-causing-problems/ Share on other sites More sharing options...
MadTechie Posted June 5, 2009 Share Posted June 5, 2009 remove the white space after the first EODl 'EOD; ' should be 'EOD;' (excluding the quotes) EDIT: full code if (($i == date("j")) && ($month == date("m")) && ($year == date("Y"))) { $EventEOD .=<<<EOD <td width="110px" height="103px" valign="top" align="center"> <div class="date_header_today"> <font class="days_today">$i</font> </div> EOD; } else { $EventEOD .=<<<EOD <td width="110px" height="103px" valign="top" align="center"> <div class="date_header_today"> <font class="days">$i</font> </div> EOD; } Note how else is green on mine (due to correct parsing) Quote Link to comment https://forums.phpfreaks.com/topic/161063-solved-heredoc-causing-problems/#findComment-849954 Share on other sites More sharing options...
Styles2304 Posted June 5, 2009 Author Share Posted June 5, 2009 Thankyou! Quote Link to comment https://forums.phpfreaks.com/topic/161063-solved-heredoc-causing-problems/#findComment-849980 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.