4
Hi everyone,
I am needing a bit of help on getting my duplicated view_calendar_week template as described above to be responsive.
The media queries/css part isnt the problem, the problem seems to lie with the way the day weeks are displayed in the template using <{foreach}>
Heres the code of the template
<{foreach item=weekdayName from=$weekdayNames}>
<h2><{$weekdayName}>h2>
<{/foreach}>
<{foreach item=day from=$week}>
<{foreach item=event from=$day.events}>
<{if $event}>
<{include file="db:extcal_info_bulle.html"}>
<div style="background-color:#<{$event.cat.cat_color}>; height:2px; font-size:2px;">
div>
<{/if}>
<{/foreach}>
<{/foreach}>
If we are using a table, this is fine, the days can be enclosed in a and will go along the top of the table horizontally, but to better suited for mobile (I have tried numerous responsive table approaches and none work that well), I am wanting to have the days and events displayed as a list like so:
Mondayevent for monday
another event for monday
Tuesdaysome tuesday event
another event
and so on.
But like I said because of the <{foreach}> which is used to display the days the days display first and then the events at the very bottom instead of each event for a particular day displaying underneath the particular day.
The php code to retrieve and assign the week day names to the template is:
// Retriving weekdayNames
$weekdayNames = Calendar_Util_Textual::weekdayNames();
for ($i = 0; $i < $xoopsModuleConfig['week_start_day']; $i++) {
$weekdayName = array_shift($weekdayNames);
$weekdayNames[] = $weekdayName;
}
// Assigning weekdayNames to the template
$xoopsTpl->assign('weekdayNames', $weekdayNames);
Is there away, using smarty or php or both that I could perhaps get the day name using its index in the array, display this in the template and still have the correct events listed under each day?
Thanks for your help