• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: [Solved]CGCalendar - why is date not displaying correctly
PostPosted: Mon May 14, 2012 1:22 am 
Offline
Power Poster
Power Poster

Joined: Sat Jan 15, 2011 8:36 am
Posts: 536
Location: Western Australia
Sorry - just realised this is is a duplicate post. Got no replies from the first - perhaps this post describes the situation better.
[Can a mod please delete the first post? Thanks]

Using 1.10.3 and current modules

How do I get the search results to show the date as it is in my list template. I have removed the spans as I don't want the title "date" included. The display is "13 June 2012" not "Date: 13 June 2012". For some reason in the search results, it comes up as
"13 2012" - the name of the month is missing.

I have adapted the search result template and am using it as below. The only things I have changed from the default are to remove the spans for titles and added my own span around {$event.event_title} to create spaces so I can put it all on one line. I also have positioned event title after the date. I wouldn't have thought this had any bearing on the way the date is displayed but I am not very clever with smarty.

Thanks

<h3>{$mod->Lang('search_results')}</h3>
<p>{$mod->Lang('search_words')}:&nbsp;{$search_text}</p>
<p>{$mod->Lang('start_date')}:&nbsp;{$search_start_date|cms_date_format}</p>
<p>{$mod->Lang('end_date')}:&nbsp;{$search_end_date|cms_date_format}</p>
<p>{$mod->Lang('category')}:&nbsp;{if $search_category == '-1'}{$mod->Lang('cal_any_category')}{else}{$mod->GetCategoryName($search_category)}{/if}</p>
{if !isset($events)}
{$mod->Lang('no_results_found')}
{else}
<br/>

{* pagination stuff *}
{if isset($firstpage_url) || isset($lastpage_url)}
<div style="text-align: center;">
{if isset($firstpage_url)}
<a href="{$firstpage_url}">{$mod->Lang('first_page')}</a>&nbsp;
<a href="{$prevpage_url}">{$mod->Lang('prev_page')}</a>&nbsp;
{/if}
{$mod->Lang('page_of',$pagenum,$numpages)}
{if isset($lastpage_url)}
&nbsp;<a href="{$nextpage_url}">{$mod->Lang('next_page')}</a>
&nbsp;<a href="{$lastpage_url}">{$mod->Lang('last_page')}</a>
{/if}
</div>
{/if}
{* display the output *}
{foreach from=$events key=key item=event}
<div class="calendar-event">

{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 == 0}
{$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"}
{$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}
{$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}

<span class="calendar-event"></span>
{$event.event_title}
<span class="calendar-event"></span>
{if $event.event_summary !="" && ($detail != 1 || ($event.event_details =="" || $event.event_details == "<br />"))}
{$event.event_summary}
{/if}
{* optionally display detail information
{if $event.event_details !="" && $event.event_details != "<br />"}
{$event.event_details}
{/if}
*}
</div>
{/foreach}
{/if}


{if $return_url != ""}
<div class="calendar-returnlink">{$return_url}</div>
{/if}


Last edited by jasnick on Wed May 16, 2012 3:31 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: CGCalendar - why is date not displaying correctly
PostPosted: Mon May 14, 2012 3:54 am 
Offline
Power Poster
Power Poster

Joined: Sat Jan 15, 2011 8:36 am
Posts: 536
Location: Western Australia
Was looking at Smarty date format conversion and decided to add: %B to the code below:

{if $event.event_date_start == $event.event_date_end || $event.event_date_end == 0}
{$event.event_date_start|date_format:"%e %B"} {$month_names[$month_number]} {$event.event_date_start|date_format:"%Y"}

This has now given me the month name in the search results.

I don't understand why it has {$month_names[$month_number]} in the code if it doesn't output the month name without %B being added.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Arvixe - A CMSMS Partner