Share » Learn » eZ Publish » Building a custom template for a news...

Building a custom template for a news portal

Tuesday 16 May 2006 1:44:00 am

  • Currently 3 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

The three banners on the frontpage are all displayed using the same view mode (called banner).

Override settings

The override settings for this view mode are shown below, and are stored in the file settings/siteaccess/news/override.ini.append.php.

# Override for image in banner view mode
[image_banner]
Source=node/view/banner.tpl
MatchFile=banner/image.tpl
Subdir=templates
Match[class_identifier]=image

Banner template

The banner used in our news portal is simply an image. The template code for displaying this banner is:

<div style="clear:both">
 <p>
   {attribute_view_gui attribute=$node.object.data_map.image 
                              image_class=banner}
 </p>
</div>

The banner is displayed via the attribute_view_gui function. The parameters specify the image to display and the image alias banner. To link the banner to a URL, supply an additional href parameter to the attribute_view_gui function.

Image settings

The banner image has a specific maximum dimension. To make eZ publish scale images we need to define an alias for the image. In this case we will call our image alias banner. This alias ensures that the image is not larger than 560 pixels wide and 70 pixels high. The configuration is stored in settings/siteaccess/news/image.ini.append.php.

[AliasSettings]
AliasList[]=banner

[banner]
Reference=
Filters[]
Filters[]=geometry/scaledownonly=560;70
36 542 Users on board!

Tutorial menu

Printable

Printer Friendly version of the full article on one page with plain styles

Author(s)