CGCalendar pastlist with next/previous links?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
beattie
Forum Members
Forum Members
Posts: 98
Joined: Sun Dec 21, 2008 11:35 pm

CGCalendar pastlist with next/previous links?

Post by beattie »

Is there a way to add next and prev links to a list of past events? If I limit the number of events to 10 there is no way to see the previous events. If I don't limit the number of events then the page gets very long and keeps getting longer.... see here for example of page: http://www.stjohnscathedral.com.au/events/past-events.html

I am using CMS 1.8.2 with CGCalendar 1.5.2 and the list template I am using is below:

Code: Select all

<div>



{assign var='private_events' value='|'|explode:'Wedding|Baptism|Funeral'} {* category list of private event *}
{assign var='label_private_event' value='(private event, by invitation only)'} {* private event label *}

	{if isset($navigation)}
			{capture assign='cgcal_nav_tail'}{'&amp'};{$actionid}listtemplate={$smarty.template|replace:'module_db_tpl:CGCalendar;list_':''}{/capture}
			{capture assign='cgcalendar_nav'}
			<div style="border-bottom: 2px solid rgb(240, 240, 240); padding: 0pt 8px 8px; position: relative; margin-top: 8px;">

			

			{* month navigation *}
			<div style="display: block; margin: auto; width: 85%; text-align: center;">
				<span style="color: #e11831;font-size:11px;text-transform:uppercase;">
				{section name='month_navigation' start='1' loop='13'}
					{assign var='month_name_short' value='2010-%s-01 00:00:00'|sprintf:$smarty.section.month_navigation.iteration|date_format:'%b'}
					{if $month!=$smarty.section.month_navigation.iteration}
						<a style="color:#60553d;text-decoration:none" href="{module_action_link module='CGCalendar'  urlonly='1' year=$year month=$smarty.section.month_navigation.iteration display='list' eventtemplate='event'  listtemplate='list' use_session='1' }
							">{$month_name_short}</a>
					{else}
						{$month_name_short}
					{/if}
					{if !$smarty.section.month_navigation.last} | {/if}
					{/section}
				</span>
			</div>
			{* end month navigation *}

			
			</div>
			{/capture}
			{$cgcalendar_nav}
	{/if}

<p style="padding-top:20px"> </p>
{if !empty($events)}
{foreach from=$events key=key item=event}
  <div>

  <h2><a style="color: #a6b483;font-size:21px;text-decoration:none" href="{$event.url}">{$event.event_title}</a></h2>
{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}
  <span style="color:#666633;font-weight:bold">{$lang.date}:</span> {$event.event_date_start|date_format:"%a %e %b %G"}<br/>
<span style="color:#666633;font-weight:bold">Time:</span> {$event.event_date_start|date_format:"%I:%M%P"}<br/>
{else}
{if $event.event_date_start|date_format:"%a %e %b %G" == $event.event_date_end|date_format:"%a %e %b %G"}
<span style="color:#666633;font-weight:bold">{$lang.date}: </span>{$event.event_date_start|date_format:"%a %e %b %G"}  <br>  <span style="color:#666633;font-weight:bold">Time:</span> {$event.event_date_start|date_format:"%I:%M%P"} - {$event.event_date_end|date_format:"%I:%M%P"}<br/>
{else}
  <span style="color:#666633;font-weight:bold">{$lang.date}:</span> {if $event.event_date_start|date_format:"%a %e %b %G"} to {$event.event_date_end|date_format:"%a %e %b %G"}<br>  <span style="color:#666633;font-weight:bold">Time:</span> {$event.event_date_start|date_format:"%I:%M%P"} {$lang.to} {$event.event_date_end|date_format:"%I:%M%P"}  <br/>
{/if}
{/if}{/if}

{* event categories *}
{if !empty($event.categories)}
   {assign var='private_event' value=''}
   {assign var='event_categories' value=$event.categories|@array_keys}
   <span style="color:#666633;font-weight:bold">{$CGCalendar->Lang('category')}:</span> {', '|implode:$event_categories}
   {foreach from=$event_categories item='cat_name'}
      {if in_array($cat_name, $private_events)}
         {assign var='private_event' value='1'}
      {/if}
   {/foreach}
   {if !empty($private_event)} <span style="font-weight:bold"><em>{$label_private_event}</em></span>{/if}
{/if}
{* end event categories *}

{if $event.event_summary !="" && ($detail != 1 || ($event.event_details =="" ||  $event.event_details == "<br />"))}
    <div class="description" style="padding-top:10px">{$event.event_summary}</div>
  {/if}
{* optionally display detail information 
	{if $event.event_details !="" && $event.event_details != "<br />"}
	<div class="calendar-details"><span class="calendar-details-title">{$lang.details}: </span>{$event.event_details}</div>
	{/if}
*}
<p style="margin-top:12px">
<a style="text-decoration:none;color:#98a677" href="{$event.url}">more details  »</a></p>

  </div>

<div style="border-bottom: 1px dashed #e11831;padding-bottom:10px;"> </div>
{/foreach}
{else}

<div style="border-top: 1px dashed #e11831;padding-bottom:7px;margin-top:17px"> </div>
<p><em>There are currently no events.</em></p>

<div style="border-bottom: 1px dashed #e11831;padding-bottom:7px;"> </div>
{/if}

<div>

			{if isset($navigation)}
				{$cgcalendar_nav}
			{/if}

		</div>


<P></p>
<P></p>

{if $return_url != ""}
  <div class="calendar-returnlink" style="clear:both;padding-top:25px">{$return_url}</div>
{/if}
</div>
This is the code on the past list page:

Code: Select all

{cms_module module="CGCalendar" display="pastlist" inline="1" reverse="true"}
I have searched the forum but can't find an answer to this particular problem, maybe I am missing something simple. The prev/next navigation code for the standard list template doesn't work for the upcoming or past list template.

Many thanks for any suggestions!
beattie
Forum Members
Forum Members
Posts: 98
Joined: Sun Dec 21, 2008 11:35 pm

Re: CGCalendar pastlist with next/previous links?

Post by beattie »

bump  :)
User avatar
M@rtijn
Power Poster
Power Poster
Posts: 706
Joined: Sat Nov 14, 2009 4:54 pm

Re: CGCalendar pastlist with next/previous links?

Post by M@rtijn »

I've been trying to solve this one too.
(don't know how good your dutch is: http://forum.cmsmadesimple.org/index.ph ... #msg197869)

Turned out there is (or: was at that time) no feature in CGCalendar to make prev/next links. My goal was to make something which worked like '"if" more then 10 items "then" create new page'

I got the tip to look into the Smarty Paginate function: http://www.phpinsider.com/php/code/SmartyPaginate/

Unfortunately I've not had the time to look into it (or maybe I did not need it that bad at that time)
But maybe it could help you?
Make your community a better place!
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

Re: CGCalendar pastlist with next/previous links?

Post by paulbaker »

Bump. Beattie's event page is even longer now. :)

Wondering if anyone has a solution for this now?

Basically to show the CGCalendar pastlist but with n events per page, stepping back in time for each page.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: CGCalendar pastlist with next/previous links?

Post by calguy1000 »

there is still no pagination on the pastlist stuff

for efficiency I would either break out of the loop after N events or use some filtering to break after the loop after N months worth of events or something.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Locked

Return to “Modules/Add-Ons”