Conditional output in em_events::get() loop
-
Hey guys,
I found (and customized) a code snippet to show the next few events on my front-page.php by using a loop. Now I’d like to show the location-div (“.termin_details_ort”) only if a location exists.
I didn’t find a way to do that, any suggestions?
NOTE: I’m not THAT familiar with PHP. 🙁
<?php $events = EM_Events::get(array('limit'=>3, 'orderby'=>'event_start_date,event_start_time')); foreach ( $events as $event ) { ?> <div class="termin_teaser box third"> <h3><?php echo $event->output('#_EVENTNAME'); ?></h3> <p class="termin_datum"><?php echo $event->output('#_EVENTDATES'); ?>, <?php echo $event->output('#_EVENTTIMES'); ?></p> <p class="termin_ort"><?php echo $event->output('#_LOCATIONTOWN'); ?>, <?php echo $event->output('#_LOCATIONCOUNTRY'); ?></p> <div class="termin_toggle">Mehr Details</div> <div class="termin_details green box"> <div class="termin_meta"> <h3><?php echo $event->output('#_EVENTNAME'); ?></h3> <div class="termin_details_datum"><p class="termin_details_datum"><?php echo $event->output('#_EVENTDATES'); ?>, <?php echo $event->output('#_EVENTTIMES'); ?></p></div> <!-- ##################################### show/hide following line ##################################### --> <p class="termin_details_ort"><?php echo $event->output('#_LOCATIONTOWN'); ?>, <?php echo $event->output('#_LOCATIONCOUNTRY'); ?></p> <!-- ##################################### show/hide line above ##################################### --> <p class="termin_details_beschreibung"><?php print $event->output('#_EVENTEXCERPT'); ?></p> <p class="termin_details_link"><a href="<?php print $event->output('#_ATT{termin_details_link}'); ?>" target="_blank">Details & Anmeldung ›</a></p> </div> <?php echo $event->output('#_EVENTIMAGE'); ?> </div> </div> <div class="clear"></div> <?php } ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Conditional output in em_events::get() loop’ is closed to new replies.