Solution for avoid all block in adding list of zone layout

Author Message

Bin LIU

Friday 18 April 2008 2:34:52 am

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

=== Lagardère Active ===

Fetch random
http://projects.ez.no/la_fetch_random
LA Static Cache
http://projects.ez.no/lastaticcache
LA Bookmarks (jquery)
http://projects.ez.no/labookmark
LA Calendar (jquery)
http://projects.ez.no/lacalendar

My site ez
http://lingping.info

Sebastian Schoeller

Wednesday 10 February 2010 12: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

Stefan Eickhoff

Wednesday 26 January 2011 1: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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 00:55:08
Script start
Timing: Jan 18 2025 00:55:08
Module start 'layout'
Timing: Jan 18 2025 00:55:08
Module start 'content'
Timing: Jan 18 2025 00:55:09
Module end 'content'
Timing: Jan 18 2025 00:55:09
Script end

Main resources:

Total runtime0.7367 sec
Peak memory usage4,096.0000 KB
Database Queries61

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0099 588.2031152.6563
Module start 'layout' 0.00990.0055 740.859439.5234
Module start 'content' 0.01530.7198 780.3828586.0625
Module end 'content' 0.73510.0016 1,366.445312.0859
Script end 0.7367  1,378.5313 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.4425160.0002
Check MTime0.00130.1832160.0001
Mysql Total
Database connection0.00110.143610.0011
Mysqli_queries0.656989.1674610.0108
Looping result0.00100.1350590.0000
Template Total0.672291.220.3361
Template load0.00190.253920.0009
Template processing0.670390.979420.3351
Template load and register function0.00010.019910.0001
states
state_id_array0.00230.308510.0023
state_identifier_array0.00260.351020.0013
Override
Cache load0.00170.2272320.0001
Sytem overhead
Fetch class attribute can translate value0.00140.196630.0005
Fetch class attribute name0.00140.192550.0003
XML
Image XML parsing0.01492.021430.0050
class_abstraction
Instantiating content class attribute0.00000.001750.0000
General
dbfile0.01702.3067200.0008
String conversion0.00010.009640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
6content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 24
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs