I added <h1>Test</h1> to the next content block then removed it. Then had a look at Page Source as you suggested: the tag was still there although the actual word 'test' was gone.
<div class="box">
<h1> </h1>
</div>
[Solved]Trying to Hide Empty Content Blocks
Re: Trying to Hide Empty Content Blocks
Obviously the variable contains '<h1></h1>' which is not an empty string.
So now you have to check why that content stays in there.
You are aware of the 'view html' checkbox below the wysiwyg editor while changing page content? If checked I expect the '<h1></h1>' to be there.
Choose select all (ctrl-a) and delete all content. Mind that a single space or enter is content too.
So now you have to check why that content stays in there.
You are aware of the 'view html' checkbox below the wysiwyg editor while changing page content? If checked I expect the '<h1></h1>' to be there.
Choose select all (ctrl-a) and delete all content. Mind that a single space or enter is content too.
Re: Trying to Hide Empty Content Blocks
I always use...
{content block='newsblock' assign='test'}
{if !empty($test)}
<div class="content">
{$test}
</div>
{/if}
Test if it's not empty, if not show it...
{content block='newsblock' assign='test'}
{if !empty($test)}
<div class="content">
{$test}
</div>
{/if}
Test if it's not empty, if not show it...
Re: Trying to Hide Empty Content Blocks
Sorry if I haven't made myself clear.Yes I am aware of the html checkbox - that is what I have been using myself to remove the left-over tags. it is just that I don't want the editor to use it.velden wrote:You are aware of the 'view html' checkbox below the wysiwyg editor while changing page content? If checked I expect the '<h1></h1>' to be there.
I wonder if that is the problem. Yes, the text and image are indented and spaced. I'll check it when I start work this morning.velden wrote:Choose select all (ctrl-a) and delete all content. Mind that a single space or enter is content too.
Thanks Dr.CSS - I'll also check that out this morning.
Re: Trying to Hide Empty Content Blocks
Yes - that was it! I was deleting them in the editing box one at a time (text and image) instead of selecting both together which of course incorporated the indenting space and the line space.velden wrote:Choose select all (ctrl-a) and delete all content. Mind that a single space or enter is content too.
I won't forget THAT in a hurry!

Thank you so much for your patience, Velden and for the input from Rolf, Paul, Rotezecke and Dr.CSS.
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: [Solved]Trying to Hide Empty Content Blocks
something like this should work:
Code: Select all
{content assign='foo'}
{assign var='foo' value=$foo|strip_tags|strip}
{if $foo != ''}<div id="foo">{$foo}</div>{/if}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: [Solved]Trying to Hide Empty Content Blocks
Thanks Calguy1000 - I'll try that too!
Re: [Solved]Trying to Hide Empty Content Blocks
But this will give you unformatted text when you DO want content, doesn't it?calguy1000 wrote:something like this should work:Code: Select all
{content assign='foo'} {assign var='foo' value=$foo|strip_tags|strip} {if $foo != ''}<div id="foo">{$foo}</div>{/if}
What about this:
Code: Select all
{content assign='foo'}
{assign var='foo_stripped' value=$foo|strip_tags|strip}
{if $foo_stripped != ''}<div id="foo">{$foo}</div>{/if}