Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
9 - 8 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
     

Re: Would like to hide a block depending on its content
by C6_chus on 2007/11/1 13:30:54

Thanks a lot guys. I think your tips will be of a great help so far.
To avoid confusions, in my case I have to process the block to know it is empty.

May thanks again.

;)
Re: Would like to hide a block depending on its content
by Will_H on 2007/11/1 11:14:07

As a designer, I would utilize the smarty technique, but for my own sites it would be a core hack.

We really should start to compile a list of community requested core inclusions. Because there are just too many things this cms cannot do without hacking the core.

I agree with catz, it doesn't make sense to hit the db for no reason.
Re: Would like to hide a block depending on its content
by Catzwolf on 2007/11/1 5:25:34

Quote:

snow77 wrote:
I can tell you how to hide it completely but not depending on it's contents...it would be more like Zyspec's way for it to be dynamic... the trick would somewhere in the <{if}> I think, but don't take me for sure, it's little what I know of smarty.

To hide it completely, here is an example (hiding a block titled navbar):

le="color: #000000"><?php <{if $block.title != 'navbar'}> <{if $block.title}><div class="xo-blocktitle"><h3><{$block.title}></h3></div><{/if}> <div class="xo-blockcontent"><{$block.content}></div> <{/if}>


If you could find a way to do it by smarty variables I think it could be much simpler.


I agree with you, but I wasn't sure if he wanted to do the check before the block was processed or not. Because doing it the smarty way just 'hides' the block not actually prevent it from being processed and taking up more array space. In reality it would be easier if there was a config to allow the admin to turn off blocks without any content.

ATB

Catz
Re: Would like to hide a block depending on its content
by snow77 on 2007/11/1 3:54:22

I can tell you how to hide it completely but not depending on it's contents...it would be more like Zyspec's way for it to be dynamic... the trick would somewhere in the <{if}> I think, but don't take me for sure, it's little what I know of smarty.

To hide it completely, here is an example (hiding a block titled navbar):

le="color: #000000"><?php <{if $block.title != 'navbar'}> <{if $block.title}><div class="xo-blocktitle"><h3><{$block.title}></h3></div><{/if}> <div class="xo-blockcontent"><{$block.content}></div> <{/if}>


If you could find a way to do it by smarty variables I think it could be much simpler.
Re: Would like to hide a block depending on its content
by zyspec on 2007/11/1 3:27:03

It really depends on how your block is written - I've done something similar to the following in a block template for some blocks I've created:

le="color: #000000"><?php <{if (!empty($block.contents))}> <div> display block contents </div> <{/if}>

This will only display the block if the contents aren't empty...

Who's Online

483 user(s) are online (405 user(s) are browsing Support Forums)


Members: 0


Guests: 483


more...

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits