eZ Community » Forums » Extensions » eZ Flow » Solution for avoid all block in...
expandshrink

Solution for avoid all block in adding list of zone layout

Solution for avoid all block in adding list of zone layout

Friday 18 April 2008 11:34:52 am - 3 replies

In a zone, by defaut, it allow create all the block type.
For avoid it, change the template page/zone.tpl.
line 11 :

{foreach ezini( 'General', 'AllowedTypes', 'block.ini' ) as $type}

By

{foreach ezini( concat($attribute.content.zone_layout,'_zone',$zone_id) , 'AllowedTypes', 'block.ini' ) as $type}

And define the list block allowed by zone de layout in block.ini.

like this

#block.ini.

[HomeTOTO_zone1]

AllowedTypes[]=block1

AllowedTypes[]=block2

[HomeTITI_zone2]

AllowedTypes[]=block3

Modified on Friday 18 April 2008 11:36:27 am by Bin LIU

Wednesday 10 February 2010 9:54:33 am

Hi Bin Liu,

thanks for the very useful hack. I altered it so that blocks are en-/disabled per layout.

{foreach ezini( $attribute.content.zone_layout , 'AllowedBlocks', 'zone.ini' ) as $type}

Afterwards the zone.ini needs to be extended as follows

[GlobalZoneLayout]
ZoneTypeName=Global zone layout
Zones[]=main
ZoneName[main]=Global zone
ZoneThumbnail=globalzone_layout.gif
Template=globalzonelayout.tpl
AvailableForClasses[]=global_layout
AllowedBlocks[]=DemoBlock
AllowedBlocks[]=Manual2Items
AllowedBlocks[]=Manual3Items
AllowedBlocks[]=Manual4Items
AllowedBlocks[]=Manual5Items
AllowedBlocks[]=Dynamic3Items

Works and does the job, although your hack is more fine grained. Thanks for the hint and best wishes

Sebastian

Wednesday 26 January 2011 10:20:50 am

Hi Bin Liu,

very usefull tip, thank you.

I use it that way

- use zone_identifier string
- use [General]-Block as default

{def $allowedBlocks = cond(ezini( concat($attribute.content.zone_layout,'_', $zone.zone_identifier) , 'AllowedTypes', 'block.ini' )|count(), ezini( concat($attribute.content.zone_layout,'_', $zone.zone_identifier) , 'AllowedTypes', 'block.ini' ), ezini( 'General', 'AllowedTypes', 'block.ini' ))} 
 
{foreach $allowedBlocks as $type}
 <option value="{$type}">{ezini( $type, 'Name', 'block.ini' )}</option>
 {/foreach}
#block.ini
 
[MyLayout_left]
AllowedTypes[]=news
AllowedTypes[]=content
 
[MyLayout_right]
AllowedTypes[]=teaser

lg

Stefan

Modified on Wednesday 26 January 2011 11:44:37 am by Stefan Eickhoff

Tuesday 24 April 2012 11:34:56 am

We do it like this.

{foreach $this_node.data_map.page.content.zones.1.blocks.2.valid_nodes as $valid_node max 1}
{$valid_node.node_id}
{/foreach}
Block.ini
[Pages_zone0]
[Pages_zone1] 

Modified on Tuesday 24 April 2012 11:40:21 am by

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from