Jump to content

Show repeater everywhere


tooth-paste
 Share

Recommended Posts

I have build an agenda with repeater. Now I would like to show three recent items(limit=3) on the homepage but can not get it to work. I've tried several things like, pages, get, find template. 

system template(setup->temp->filter): repeater_agendaitem

Original code on agenda page(works perfect):

if(count($page->agendaitem)) {
	$today = strtotime("today");
	$upcoming_dates = $page->agendaitem->find("agenda_datum>=$today, sort=agenda_datum");
						
	if(count($upcoming_dates)) {
			foreach($upcoming_dates as $upcoming_date) {
						
					echo "<h4>{$upcoming_date->agenda_activiteit}</h4><p>
					<b>{$upcoming_date->agenda_datum} {$upcoming_date->agenda_tijd}</b><br />
					{$upcoming_date->agenda_beschrijving} </p>
					<div class='stippellijnzwart'></div>";						
					} 
			} 
	} 

 

 

Link to comment
Share on other sites

To get the repeateritems when they do not live on the current page, you do:

  $upcoming_dates = $pages->get(ID-of-repeaterpage)->agendaitem->find("agenda_datum>=$today, sort=agenda_datum");

and you go from there.

  • Like 5
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...