Zen Cart Template Structure

From Zen Cart(tm) Wiki
(Redirected from Zencart template structure)
Jump to: navigation, search

<This is a work in progress>

A template is a "a pre-developed page layout in electronic or paper media used to create new pages from the same design, pattern, or style" (wikipedia.org)

Unlike "static" pages, all Zen Cart pages are created on-the-fly, and using a template system is the only way to create a consistent "look" throughout the site.

In this article we will check all Zen Cart common template files to get a better understanding of ZC template system. Please note that Zen Cart files are well commented, and each file has its own description and such included, so if you are interested in a certain file and want to know more please view the content of that file.


I. Common template files

(located in includes/templates/template_default/common)

This folder contains all the files that are usually loaded on all pages (hence the name "common")

1. Important files (files that you will likely edit a lot to customize your template)

tpl_header.php: this is the file that contains the "header" of your template

tpl_footer.php: this is the file that contains the "footer" of your template

tpl_main_page.php: this file contains the whole "body" part of your template. It loads tpl_header.php, tpl_footer.php and all the content between the header and footer.

tpl_box_default_left.php: this file contains the general layout of the left column boxes

tpl_box_default_right.php: this file contains the general layout of the right column boxes

tpl_tabular_display.php: this file is used for generating tabular output where needed, based on the supplied array of table-cell contents. This one uses table instead of div, and it's the one to look at if you are display products by rows, not columns.

tpl_columnar_display.php: this file is used for generating tabular output where needed, based on the supplied array of table-cell contents. This one uses div instead of table, and it's the one to look at if you are using display by columns.

2. Not so important files (files that you can often leave them "as is")

html_header.php: this file loads the <html> and <head> of the page, with all the appropriate metatags, css and javascript files.

main_template_vars.php: Common Template main_template_vars handler


For more info, please check Zen Cart template's FAQ section [1]: and other wiki articles: http://www.zen-cart.com/wiki/index.php/Customisation_-_Templates