Forums / Cotonti / Support / stoopid question

Kingsley
#1 2011-08-30 10:16

I have 2 page fields:

{PAGE_AUTHOR} and {PAGE_SOURCE} and I want a small text (None, or No information available) to appear when both fields are empty.

But when one field is filled in, that field must appear, and the text must disappear.

is that possible with the IF/ENDIF tags?

I can do it for both fields seperately, but what I can't figure out is how to do that with both fields at once..

 

Does it make any sense? look at the example below, maybe you'll see what I mean:

 

<!-- IF {PAGE_AUTHOR} -->
    <strong class="small">{PHP.L.Author}:</strong> {PAGE_AUTHOR}
    <hr />
<!-- ELSE -->    
No information available
<!-- ENDIF -->
<!-- IF {PAGE_SOURCE} -->
    <strong class="small">{PAGE_SOURCE_TITLE}:</strong><br /><br />
    <div style="font-size:10px;"><a href="{PAGE_SOURCE}" target="_blank">{PAGE_SOURCE}</a></div>
    <hr />
<!-- ENDIF -->
GHengeveld
#2 2011-08-30 11:17
<!-- IF {PAGE_AUTHOR} OR {PAGE_SOURCE} -->
  <!-- IF {PAGE_AUTHOR} -->
    <strong class="small">{PHP.L.Author}:</strong> {PAGE_AUTHOR}
    <hr />
  <!-- ENDIF -->
  <!-- IF {PAGE_SOURCE} -->
    <strong class="small">{PAGE_SOURCE_TITLE}:</strong><br /><br />
    <div style="font-size:10px;"><a href="{PAGE_SOURCE}" target="_blank">{PAGE_SOURCE}</a></div>
    <hr />
  <!-- ENDIF -->
<!-- ELSE -->
No information available
<!-- ENDIF -->
This post was edited by Koradhil (2011-08-30 13:38, 12 years ago)
Kingsley
#3 2011-08-30 14:02

Koradhil, you the man..

GHengeveld
#4 2011-08-31 11:43

Nested logic blocks are a relatively new feature, so I'm not surprised you didn't think of it.

Kingsley
#5 2011-08-31 11:52

I love them man, haven't seen them in any other system so far, and that's their loss. Guess I don't know half of what is possible with it, but it's a very useful option in Cotonti.

Is there any documentation on it? I'd love to know more about it

GHengeveld
#6 2011-08-31 13:15
I'm working on an article that discusses a lot of Cotonti's "hidden features". I think we will release a series of those, since it's a lot of work.
Kingsley
#7 2011-08-31 13:19

If you want/need Dutch translation of those docs.. holla..

Added 1 minute later:

* slaps himself in the face* you are dutch too, forgot that for a moment.. But the offer stands..