Page 1 of 1

[SOLVED] Checking for empty content block (conditions in templates)

Posted: Fri Aug 01, 2008 10:28 pm
by spcherub
I would like to make a section of my template conditional, i.e., based on the presence of content. I know I can do something like this to check for values in $content:

Code: Select all

{if !$empty($content)}
<div>
blah blah
</div>
{/if}
But what are the parameters for the empty() function if I am checking for the presence/absence of another named content block (like when I use {content block='promo'}?

Thanks!

Re: [SOLVED] Checking for empty content block (conditions in templates)

Posted: Sat Aug 02, 2008 2:35 pm
by spcherub
I did some more searching of the forum and came upon this solution: http://forum.cmsmadesimple.org/index.ph ... 357.0.html

So in my specific example, I would do something like this:

Code: Select all

{content block='promo' assign='promo'}
{if !$empty($promo)}
<div>
blah blah
</div>
{/if}
Thanks to the original poster and repliers!