Search the Community
Showing results for tags 'repeat'.
-
Hi, I am in the process of creating a local news site, based on ProcessWire. Among other things, the site will be presenting local events, and I have a question specifically about recurring events. Events (recurring or not) shall be shown in *one* list, like in this example: 10.01.2019 19:30 - Some event (Page #1235) 11.01.2019 17:15 - Another event (Page #1237) 12.01.2019 16:00 - The Final Event (Page #1239) When I have recurring events, I would like to keep these on the same page (using a Repeater field) as shown here: 10.01.2019 19:00 - A Star is Born film, showing in Cinema ABC (Page #1234 holds all occurrences) 10.01.2019 19:30 - Some event (Page #1235) 11.01.2019 19:30 - A Star is Born film, showing in Cinema ABC (Page #1234 holds all occurrences) 11.01.2019 17:15 - Another event (Page #1237) 12.01.2019 20:00 - A Star is Born film, showing in Cinema ABC (Page #1234 holds all occurrences) 12.01.2019 16:00 - The Final Event (Page #1239) The editing interface will use these fields: id title date_start - a datetime field (use for one-time events) time_start - a text field dates - Repeat field with these sub-fields: date_start - a datetime field (use for recurring events) time_start - a text field Listing events by date_start is simple when the site only has run-once events (using the 'date_start' field). But when repeated events enter the picture, it is necesssary to generate all occurrences for each repeated event ('dates.date_start') - and join these with the list of run-once events ('date_start'). I am unsure if that is possible? PS: I am aware that Ryan created an Events fieldtype module, unfortunately the site needs more detail about each event than this module offers so it is easier to create a site-specific set of Event fields.
-
so i am trying to fetch repeat field from page and output it, but only first one !, i thought first() would work and i googled something and came up with this if ($pages->get('/ponuka/')->title) { $ponuka = $pages->get('/ponuka/'); } else { $ponuka = $pages->get(1239); } //echo $ponuka; foreach($ponuka->children as $child) { $first = $child->repeat_body->find("limit=1"); $image = $child->pod_thumb; $options = array('quality' => 70, 'upscaling' => true, 'cropping' => 'north', 'sharpening'=>'medium'); $thumb = $image->size(400, 300, $options); echo " <li> <h3>$child->title</h3> <div class='split reversed'> <div class='content'>"; foreach($ponuka->repeat_body->find("limit=1") as $rep) { echo $rep->body; } echo "<ul class='actions'> <li><a href='{$child->repeat_body->first()->url}' class='button'>Pokračovať</a></li> </ul> </div> <div class='image'><img src='$thumb->url' alt='' /></div> </div> </li>"; } first check is just, if client somehow renames the site or changes url of that site, that it would fall back to fetching it from ID, and if they delete that site and create new one but with same name it will still work, so i hope that wont be a problem, then i output some stuff from that site, but i have trouble outputting the repeat field, as you can i see i tried it with find but didnt worked, what is the correct way to approach this ?