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

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

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

Post 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!
Last edited by spcherub on Sat Aug 02, 2008 2:33 pm, edited 1 time in total.
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

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

Post 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!
Post Reply

Return to “CMSMS Core”