Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Introduction to the Main Layout

Kevin Ottley edited this page Apr 10, 2014 · 2 revisions

Prev | Next

##Layout files The top of the pyramid is the "layout" file. There are two layout files in a default Yii installation, column1.php and column2.php. As you can probably tell by their names, these control the layout in either a single column (the entire width of the page), or in two-column format. For Web Store purposes, column1 is used whenever we wish the content to display all the way across. In the brooklyn theme for example, the checkout page utilizes this layout.

Column2 is used when we want to seperate the content into 2 columns. In the brooklyn theme, the main content is displayed in the first column and takes up about 70% of the page, and the other column comprises of the shopping cart and sidebars along the right side.

No matter if you're using column1 or column2, they each call a file main which is the primary HTML wrapper page. (Note that all view and theme files are .php files, but for convention, we won't keep repeating the extension here. You can assume a file such as main is named main.php.) Main is the file that begins "<!DOCTYPE html>" and ends by closing our "</body>" tag. Main in turn calls other files, for things like our <head> meta data, menus, navigation bars, etc. All of these files are located in /views/layouts which you can view. (If you have followed our directions for copying a theme, these files will all be under /themes/brookyncopy/views)

(Note that our documentation will refer to brooklyncopy as the theme in progress here because generally most people will copy the brooklyn theme to work with. If you have made a copy of a different theme, you would have a different folder name.)

Web Store has a default programmed in for each type of page. For instance,

  • Checkout uses column1
  • Custom pages, Product display, Customer registration, etc. all use column2.

Important: There is a Yii documentation page which discusses the hierarchy and view flow which you should read at http://www.yiiframework.com/wiki/249/understanding-the-view-rendering-flow/

Clone this wiki locally