Search:     Advanced search

Designing various templates blocks

Article ID: 49
Last updated: 22 Mar, 2012
Revision: 5
Print
Export to PDF
Email to friend
Add comment
Views: 0
Comments: 0

A Block is basically a data resource for Views. It uses the sites Models, grabs the data, makes any necessary adjustments, and then makes that data available to a View. For instance, when you override / create a Block that calls a product collection, that product collection is pulling some products’ data from a Model. The Block is where you create such a product collection and implement the product collection’s methods, such as adding filters or ordering the products in a certain way. That product collection is then made available to your View so you can display the products on a page.

The Application uses templates and shapes to build views. Templates are conceptually similar to partial views in application MVC, and they provide the basic structure for rendering shape data in a page. A template can contain web page content such as HTML markup, CSS styles, and JavaScript code to help render shape data. In addition, a template can contain server-code blocks so that you can access and render shape data in a web page. Shapes are dynamic data models that represent content structures such as menus, menu items, content items, documents, and messages. Shapes provide the data for dynamic views (as opposed to the static views in MVC) that templates render at run time. 

The view engine is responsible for parsing the template and rendering the shape data into a web page. The default view engine for our Web application is the zend view engine, which is processed by Zend Partial view helper. 

The Partial view helper is used to render a specified template within its own variable scope. The primary use is for reusable template fragments with which you do not need to worry about variable name clashes. Additionally, they allow you to specify partial view scripts from specific modules. 

Block  Files  :      All block file are located at  /application/layouts/scripts/<$TemplateP>/blocks/ 

Naming Convention :  By default all block files are named as ModuleName_PageName_Position_BlockName.phtml

An Example   :    The block name gallery_home_content_videoplayer.phtml interprets as follows: 

gallery = ModuleName 
home = page
content = Position 
videoplayer.phtml  = Name of block

By default all blocks are located at  /<$ServerPath> /application/layouts/scripts/<$TemplatePath>/blocks/ . You can create custom block using Zend Partial view helper. Click  Here to know more about Zend Partial view helper 

Sample Block Example :

This article was:  
Also read
document What is Website template
document Default location of Templates , JS , CSS and Images.
document Creating Custom Blocks
document Concept of MVC Modules
document Customization of individual Modules theme.
document Architecture overview/Modules folder
document Architecture overview/Configuration files
document Sample Templates indicating the how design blocks are set.

Also listed in
folder Templates Customization
folder Developer Documentation

Prev   Next
Why all of your applications are based on CMS (Content...     Creating Custom Blocks