[SOLVED] Show Content-Block and additional HTML only if block contains data?
Posted: Fri Oct 26, 2007 8:41 pm
Hi there,
due to the help of the forum (mainly by reading), I could already get down the road pretty far. The technical issues are nearly all solved, so I am beginning to re-do everything the clean way and bring the templates to live. Thanks again for the indirect support and answers to my questions.
But now I got stuck again.
For the article template, I'd like to post up to 3 optional links. The specific page template contains 6 fields. 3 for the URLs and 3 descriptions. I implement the links in the template like this:
But if no content would be provided, I also want the sourrounding HTML to be hidden as well. I wondered wether there is a solution which doesn't require a user tag or something like this. I am not much of a coder and I already spent hours of searching. Probably I took the wrong word for the query (then please give me hint).
I tried something like this:
But that didn't work as it still shows the. As far as I understood by now, I check if a variable exists, but the variable is created even when the element is empty (I hoped it would work). I already spent hours on searching and reading but couldn't get any closer.
If you could point me to the right direction or coincidentaly have a solution at hand, I would be very thankfull:)
best regards
nils
due to the help of the forum (mainly by reading), I could already get down the road pretty far. The technical issues are nearly all solved, so I am beginning to re-do everything the clean way and bring the templates to live. Thanks again for the indirect support and answers to my questions.
But now I got stuck again.
For the article template, I'd like to post up to 3 optional links. The specific page template contains 6 fields. 3 for the URLs and 3 descriptions. I implement the links in the template like this:
Code: Select all
...
<li class="article_links_item">
<a href="http://{content block="exturl2" oneline="true"}">{content block="exturl2_desc" oneline="true"}</a>
</li>
...
I tried something like this:
Code: Select all
...
{capture assign="url2"} {content block="exturl2"} {/capture}
{if isset($url2)}
...html...
{/if}
...
If you could point me to the right direction or coincidentaly have a solution at hand, I would be very thankfull:)
best regards
nils