jbradley04 Posted September 24, 2010 Share Posted September 24, 2010 Hello, I am trying to take a calendar script and use it on my site that uses Smarty templates. I have gotten all of it to work minus one spot! I am having trouble trying to get the code below to output what I want in Smarty... I have tried many things but to no avail! Any help would be appreciated! Thanks!! Obviously I want the html output from these PHP calls but I cant figure it out! Thanks for your help! for($i=0; $i< $total_rows; $i++) { for($j=0; $j<7;$j++) { $day++; if($day>0 && $day<=$total_days_of_current_month) { //YYYY-MM-DD date format $date_form = "$current_year/$current_month/$day"; //echo $date_form_good = '<td'; //check if the date is today if($date_form == $today) { $class_today = ' class="today"'; } //check if any event stored for the date if(array_key_exists($day,$events)) { //adding the date_has_event class to the <td> and close it $event_today = ' class="date_has_event"> '.$day; //adding the eventTitle and eventContent wrapped inside <span> & <li> to <ul> $event_title = '<div class="events"><ul>'.$events[$day].'</ul></div>'; } else { //if there is not event on that date then just close the <td> tag $no_event = '> '.$day; } $close_tag= "</td>"; } else { //showing empty cells in the first and last row $mts = '<td class="padding"> </td>'; } } $close_row = "</tr><tr>"; } Link to comment https://forums.phpfreaks.com/topic/214313-need-php-smarty-tpl-help/ Share on other sites More sharing options...
jbradley04 Posted September 24, 2010 Author Share Posted September 24, 2010 Sorry.. That was actually the code I changed a bit! Here is the original! Thanks again! for($i=0; $i< $total_rows; $i++) { for($j=0; $j<7;$j++) { $day++; if($day>0 && $day<=$total_days_of_current_month) { //YYYY-MM-DD date format $date_form = "$current_year/$current_month/$day"; '<td'; //check if the date is today if($date_form == $today) { echo ' class="today"'; } //check if any event stored for the date if(array_key_exists($day,$events)) { //adding the date_has_event class to the <td> and close it echo ' class="date_has_event"> '.$day; //adding the eventTitle and eventContent wrapped inside <span> & <li> to <ul> echo '<div class="events"><ul>'.$events[$day].'</ul></div>'; } else { //if there is not event on that date then just close the <td> tag echo '> '.$day; } echo "</td>"; } else { //showing empty cells in the first and last row echo '<td class="padding"> </td>'; } } echo "</tr><tr>"; } Link to comment https://forums.phpfreaks.com/topic/214313-need-php-smarty-tpl-help/#findComment-1115250 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.