Jump to content

Find / Output Page With Repeater Multiple Times


kater
 Share

Recommended Posts

Hi,

I'm doing something wrong here:

I have following structure for an event page that allows for multiple additional dates if neccesary and i want to display all for this year:

EVENT

- event_begin

- event_end

- daterepeater

-- daterepeater.event_begin

-- daterepeater.event_end

$thisyr=date(Y);
$nxtyr=date(Y)+1;
$aftnxtyr=date(Y)+2;
            echo "<h1>{$page->title}</h1>";
            echo $thisyr;
            foreach($pages->find("event_ende|event_daterepeater.event_ende>=01/01/$thisyr,event_beginn|event_daterepeater.event_beginn<01/01/$nxtyr") as $s) {
            echo "<li><a href='{$s->url}'>{$s->title}</a>, {$s->event_beginn} - {$s->event_ende} | {$pages->get("$s->event_location")->title}</li>";
            }

Basically it works. The event page is found but the output happens only once and not for every matching entry in the repeater. Do i need a nested loop to output those (i might need it anyway to output the repeater dates but i'm still struggling with the find :) )?.

thanks

Link to comment
Share on other sites

*facepalm*

$thisyr=date(Y);
			$nxtyr=date(Y)+1;
			$aftnxtyr=date(Y)+2;
            echo "<h1>{$page->title}</h1>";
            echo $thisyr;
            foreach($pages->find("event_ende|event_daterepeater.event_ende>=01/01/$thisyr,event_beginn|event_daterepeater.event_beginn<01/01/$nxtyr") as $s) {
            
            echo "<li><a href='{$s->url}'>{$s->title}</a>, {$s->event_beginn} - {$s->event_ende} | {$pages->get("$s->event_location")->title}</li>";
            
            foreach($s->event_daterepeater as $sr) {
            echo "<li><a href='{$s->url}'>{$s->title}</a>, {$sr->event_beginn} - {$sr->event_ende} | {$pages->get("$s->event_location")->title}</li>";
	        }}
            
            echo "</br>Vorschau $nxtyr";
            foreach($pages->find("event_beginn>01/01/$nxtyr,event_beginn<01/01/$aftnxtyr") as $s) {
            echo "<li><a href='{$s->url}'>{$s->title}</a>, {$s->event_beginn} - {$s->event_ende} | {$pages->get("$s->event_location")->title}</li>";
            }
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

×
×
  • Create New...