Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

Defining page layouts

By default eZ Flow has five layouts. The screenshot below shows the editor's view for selecting one of the five layouts in the Website Interface. Because layouts are defined via a configurable plug-in system, it is possible to create custom layouts.

Defining new layouts

A layout is a combination of zones that are placed on a page. The placement of the zones is defined in a template that is specified as part of the layout configuration. You can define as many layouts as you need. To define a new layout, edit the zone.ini file located by default in the following directory:

extension/ezflow/settings/zone.ini.append.php

Add the layout name to the AllowedTypes array.

Once you have defined the layout type, define the following settings:

Setting Name

Description

Valid values

ZoneTypeName

The name of the layout.

String

Zones[]

An array defining the available zones and their identifier.

String

ZoneName[index]

The visible name of the indexed zone. Use the zone name as the index value.

String

ZoneThumbnail

The filename of the thumbnail image to use. The thumbnail shows the arrangement of the zones. The thumbnails are by default located in the directory
extension/ezflow/design/standard/images/ezpage/thumbnails.

If you are using a custom design, place the thumbnails in the folder design/<your_design>/images/ezpage/thumbnails.

Filename

Template

The file containing the template that should be used for the layout. The layout templates are by default located in the directory

extension/ezflow/design/standard/templates/zone.

If you have a custom design the directory will be design/<your_design>/templates/zone

Filename

AvailableForClasses[]

Zone will be available for classes defined in this array.

String [class_identifier]

This example shows a configuration for a layout called '2ZonesLayout1":

[General]
AllowedTypes[]=2ZonesLayout1
 
[2ZonesLayout1]
ZoneTypeName=2 zones (layout 1)
 
Zones[]=left
Zones[]=right
 
ZoneName[left]=Left zone
ZoneName[right]=Right zone
 
ZoneThumbnail=2zones_layout1.gif
 
Template=2zoneslayout1.tpl
AvailableForClasses[]=frontpage

 Layout templates for zone definition

The template used by a layout must display the contents of the layout's zones. You can place the zones anywhere in the template. The variable that is made available in the template is called $zones. This variable is an array containing different $zone objects. Each $zone variable contains both a $zone.name and $zone.blocks.

A simple example of a layout template is shown below:

{foreach $zones as $zone}
 
 <h1>Zone: {$zone.name}</h1>
 
        {foreach $zone.blocks as $block}
            {block_view_gui block=$block}
        {/foreach}
 
{/foreach}

Geir Arne Waaler (09/11/2011 2:37 pm)

Geir Arne Waaler (09/11/2011 2:37 pm)


Comments

  • ZoneThumbnail gotcha

    While adding a new zone template to my existing project I came across this page and saw that it is possible to use your own thumbnail for the zone layout representation in the admin interface. The line that didn't really work for me was:

    "If you are using a custom design, place the thumbnails in the folder design/<your_design>/images/ezpage/thumbnails."

    In my instance my extension's design was not enabled for admin interface (and nor should it), therefore the image in :

    "<my_extension>/design/<my_design>/images/ezpage/thumbnails"

    was not picked up.

    An easy fix for this was to create:

    "<my_extension>/design/standard/images/ezpage/thumbnails"

    and place the thumbnail there. This way the admin interface picks up the thumbnail correctly, no modifications to the admin site access .ini's are required and custom files are still nicely placed in my extension.

    Hope this helps others in the same situation.