I was wondering if anyone figured out an alternate way of testing for content...
The {capture name='contentoutput'} worked for me on an older CMS MC version, but as soon as we upgraded it broke--and no changes were made to content in the database.
Thanks!
Testing to see if a content block exists / contains content
Re: Testing to see if a content block exists / contains content
There seems to be a really odd interaction between caching and a {content} block inside a {capture} block.
Say that {content block='Header Image'} displays 'get_involved.gif'.
The capture block below behaves quite oddly:
{capture name='contentoutput'}{content block='Header Image'}{/capture}
If I follow it with:
Len: {$smarty.capture.contentoutput|count_characters:true}{$smarty.capture.contentoutput|escape:"url"}[{content block='Header Image'}]
I see:
Len:105 %7Bnocache%3A80a46186b6839c425d51aa8f6587c6d7%236%7Dget_involved.jpg%7B%2Fnocache%3A80a46186b6839c425d51aa8f6587c6d7%236%7D[get_involved.jpg]
So, the content block inside the {capture} tag evaluates to something that's 105 characters long. (And that happens whether or not the content block has content.) However, the last call to a {content} tag -- the one at the end in square brackets there --- shows the correct information.
None of this happens on my localhost server which isn't caching, but it does happen on the staging server. Both are running 11.2.
If I unescape that value, I get:
{nocache:f4472ff0bc0531eee694fa8caf523d0d#5}{/nocache:f4472ff0bc0531eee694fa8caf523d0d#5}
So it looks like some form of nocache tags doesn't get evaluated if inside a {capture} pair. And that's about where my ability to poke around reaches a dead end... Maybe after some sleep I'll have a moment of cleverness...
Say that {content block='Header Image'} displays 'get_involved.gif'.
The capture block below behaves quite oddly:
{capture name='contentoutput'}{content block='Header Image'}{/capture}
If I follow it with:
Len: {$smarty.capture.contentoutput|count_characters:true}{$smarty.capture.contentoutput|escape:"url"}[{content block='Header Image'}]
I see:
Len:105 %7Bnocache%3A80a46186b6839c425d51aa8f6587c6d7%236%7Dget_involved.jpg%7B%2Fnocache%3A80a46186b6839c425d51aa8f6587c6d7%236%7D[get_involved.jpg]
So, the content block inside the {capture} tag evaluates to something that's 105 characters long. (And that happens whether or not the content block has content.) However, the last call to a {content} tag -- the one at the end in square brackets there --- shows the correct information.
None of this happens on my localhost server which isn't caching, but it does happen on the staging server. Both are running 11.2.
If I unescape that value, I get:
{nocache:f4472ff0bc0531eee694fa8caf523d0d#5}{/nocache:f4472ff0bc0531eee694fa8caf523d0d#5}
So it looks like some form of nocache tags doesn't get evaluated if inside a {capture} pair. And that's about where my ability to poke around reaches a dead end... Maybe after some sleep I'll have a moment of cleverness...
Re: Testing to see if a content block exists / contains content
has anyone found a solution for this? i tried all of the above ideas and the content still shows up even if the content is empty.
Re: Testing to see if a content block exists / contains content
I'll look into this evening...
Re: Testing to see if a content block exists / contains content
Did you ?wishy wrote: I'll look into this evening...

I am stumbling here with exactly the same problem. The capture seems empty but is filled with the nocache: message.
I am using 0.12 (fiji)
Mambo sucks, that's why I am here.
Now they call it Joomla, but it still sucks!
CMSMS rules!
Now they call it Joomla, but it still sucks!
CMSMS rules!
Re: Testing to see if a content block exists / contains content
Ok, so a patch that came to me from djnz right before I released 0.12.1 has fixed this issue. It goes something like this:
Hope that finally clears this issue up once and for all. 
Code: Select all
{content block='headercontent' assign='smartyvar'}
{if $smartyvar ne ""}<div id="somediv">{$smartyvar}</div>{/if}
