Page 1 of 1

Conditional display in loop

Posted: Sat Oct 22, 2011 12:25 am
by msealey
Loving WebYep :-) !

I have a (RTF) loop similar to this one:

Code: Select all

<?php foreach (WYLoopElement::aLoopIDs(teachers) as $webyep_oCurrentLoop->iLoopID) { $webyep_oCurrentLoop->loopStart(true); ?>
   Name: <?php webyep_richText("name", false, "../styles.css", true); ?>

   Email: <?php webyep_richText("email", false, "../styles.css", true); ?>

<?php $webyep_oCurrentLoop->loopEnd(); } ?>

How do I have the email field display only when it's populated, when it's not empty, please?

In other words if there is no value for that field, if it's empty (because there is no valid email to be entered by the editor), I don't want it to display at all on the finished page; of course it must be visible to the editor while the page is being edited.

I'm no PHP expert. Is it possible in WebYep conditionally to display a field like this, please?

TIA!

Re: Conditional display in loop

Posted: Sat Oct 22, 2011 12:49 pm
by marcus
msealey wrote:Is it possible in WebYep conditionally to display a field like this, please?

No, that's not possible.

Re: Conditional display in loop

Posted: Mon Nov 07, 2011 4:16 pm
by Eelco

Re: Conditional display in loop

Posted: Mon Nov 07, 2011 5:16 pm
by msealey
Thanks, Eelco

Re: Conditional display in loop

Posted: Tue Nov 08, 2011 12:10 pm
by Eelco
Your'e welcome.
When all browsers are ready for css3 you could also use the :empty pseudo class. Does not work in IE8 (maybe in 9) but has full support in Safari 3.1, Firefox 3, Opera 9.5 and Chrome 2.