Hello,
I am looking to write a chunk and I am not sure if logic goes into the snippet, the chunk or someplace else?
Say I have a menu for today and my snippet will return breakfast, lunch and dinner if they exist. If not
the snippet will return nothing. How do I only show breakfast and dinner if lunch is empty?
The snippet returns a file name of a pdf.
Here is the Chunk:
<p><a href="/assets/files/menus/[[+breakfast]]">Breakfast</a> | <a href="/assets/files/menus/[[+lunch]]">Lunch</a> | <a href="/assets/files/menus/[[+dinner]">Dinner</a></p>
Placeholders
[[+breakfast]]
[[+lunch]]
[[+dinner]]
-
☆ A M B ☆
- 104 Posts
I would use a chunk and some output filters, like so:
[[+breakfast:notempty=`<a href="/assets/files/menus/[[+breakfast]]">Breakfast</a>`]]
If you want to check something specific (not just empty), you might try the If snippet:
[[If?&subject=`[[+breakfast]]`&operator=`equals`&operand=`bacon`&then=`<a href="/assets/files/menus/[[+breakfast]]">Breakfast</a>`]]
Thanks that is exactly what I needed.