Forums / Extensions / eZ Flow / Solution for avoid all block in adding list of zone layout

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

eZ debug

Timing: Jan 18 2025 10:21:36
Script start
Timing: Jan 18 2025 10:21:36
Module start 'content'
Timing: Jan 18 2025 10:21:36
Module end 'content'
Timing: Jan 18 2025 10:21:36
Script end

Main resources:

Total runtime0.1593 sec
Peak memory usage4,096.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0081 588.0156180.7422
Module start 'content' 0.00810.0046 768.757899.1797
Module end 'content' 0.01270.1465 867.9375528.7188
Script end 0.1592  1,396.6563 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00342.1647200.0002
Check MTime0.00140.8476200.0001
Mysql Total
Database connection0.00130.819810.0013
Mysqli_queries0.113271.04611410.0008
Looping result0.00120.77711390.0000
Template Total0.146191.710.1461
Template load0.00100.609510.0010
Template processing0.145291.127310.1452
Override
Cache load0.00060.392510.0006
Sytem overhead
Fetch class attribute can translate value0.00090.554910.0009
XML
Image XML parsing0.00030.173210.0003
General
dbfile0.00352.2091200.0002
String conversion0.00000.003930.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs