Calendar module: Count number of {foreach from=$events ...
Posted: Fri May 01, 2009 5:18 pm
Hello,
i'm completedly new to this and I am working on a calendar to put into my footer.
(www.silverarrowsracing.com/index.php) Go to that php file, original site is plain html.
I am building everything inside CMS but as you can see the calendar does NOT limit to three items.
I was working on the list template to fit it inside the original stylesheet and that works.
I only want to limit the calendar to three next items!
How can I put a counter somewhere, so it aborts the foreach at the third one?
Even better would be to have the first one and second one in section, and the third on in a section: in the css the div2 hasn't got that vertical dottet line.
{foreach from=$events key=key item=event}
{$event.event_title}
{assign var=month_number value=$event.event_date_start|date_format:"%m"}
{assign var=end_month_number value=$event.event_date_end|date_format:"%m"}
{if $event.event_date_start == $event.event_date_end || $event.event_date_end == ""}
{$lang.date}: {$event.event_date_start|date_format:"%e"} {$month_names[$month_number]} {$event.event_date_start|date_format:"%Y"}
{else}
{if $event.event_date_start|date_format:"%d%m%Y" == $event.event_date_end|date_format:"%d%m%Y"}
{$lang.date}: {$event.event_date_start|date_format:"%e"} {$month_names[$month_number]} {$event.event_date_start|date_format:"%Y:%H:%M"} {$lang.to} {$event.event_date_end|date_format:"%H:%M"}
{else}
{$lang.date}: {$event.event_date_start|date_format:"%e"} {$month_names[$month_number]} {$event.event_date_start|date_format:"%Y %H:%M"} {$lang.to} {$event.event_date_end|date_format:"%d"} {$month_names[$end_month_number]} {$event.event_date_end|date_format:"%Y %H:%M"}
{/if}
{/if}
{$event.event_summary}
{/foreach}
Can anyone help me out on the counter thing? I tried some php code but was not working, since my knowlegde of any code is quite bad ...
Thanx!
i'm completedly new to this and I am working on a calendar to put into my footer.
(www.silverarrowsracing.com/index.php) Go to that php file, original site is plain html.
I am building everything inside CMS but as you can see the calendar does NOT limit to three items.
I was working on the list template to fit it inside the original stylesheet and that works.
I only want to limit the calendar to three next items!
How can I put a counter somewhere, so it aborts the foreach at the third one?
Even better would be to have the first one and second one in section, and the third on in a section: in the css the div2 hasn't got that vertical dottet line.
{foreach from=$events key=key item=event}
{$event.event_title}
{assign var=month_number value=$event.event_date_start|date_format:"%m"}
{assign var=end_month_number value=$event.event_date_end|date_format:"%m"}
{if $event.event_date_start == $event.event_date_end || $event.event_date_end == ""}
{$lang.date}: {$event.event_date_start|date_format:"%e"} {$month_names[$month_number]} {$event.event_date_start|date_format:"%Y"}
{else}
{if $event.event_date_start|date_format:"%d%m%Y" == $event.event_date_end|date_format:"%d%m%Y"}
{$lang.date}: {$event.event_date_start|date_format:"%e"} {$month_names[$month_number]} {$event.event_date_start|date_format:"%Y:%H:%M"} {$lang.to} {$event.event_date_end|date_format:"%H:%M"}
{else}
{$lang.date}: {$event.event_date_start|date_format:"%e"} {$month_names[$month_number]} {$event.event_date_start|date_format:"%Y %H:%M"} {$lang.to} {$event.event_date_end|date_format:"%d"} {$month_names[$end_month_number]} {$event.event_date_end|date_format:"%Y %H:%M"}
{/if}
{/if}
{$event.event_summary}
{/foreach}
Can anyone help me out on the counter thing? I tried some php code but was not working, since my knowlegde of any code is quite bad ...
