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

View Layer Files

James Pickard edited this page Feb 20, 2015 · 5 revisions

Previous | Next

Web Store is built on the Yii framework version 1.x, an MVC framework for PHP. A Controller can be thought of as a major section of Web Store. For example, we have a Product controller which is responsible for all the product detail pages. We have a Custom Page controller which is responsible for all custom pages. The Cart controller is responsible for both cart display and editing, and the entire checkout process. There's even a Site controller which handles functions that are global no matter where you are in Web Store, such as the menuing, login button, headers and footers.

Controllers are part of Web Store's core. Stores hosted in Multitenant environments do not have direct access to core files and folders.

The files that control the layout of the store are in the View Layer, which largely contains HTML and CSS as well as PHP commands from the framework to display the various elements. The View layer in Yii is hierarchical, made up of broad layout files which control major components of the layout (headers, sidebars, footers, etc), with individual files for the individual pieces.

For most major Controllers, there are a set of corresponding View files that go with it. In the /views folder, you'll see sub-folders that match each of these Controller names. For example, the cart sub-folder contains view files that belong to anything cart related, such as displaying the cart and checkout. The mail sub-folder contains view files that deal with anything sent by email, such as receipts to the user, or when someone uses the Contact Us form to email the store.

The structure of these folders makes it very easy to find and customize the portion of the program you're looking for. If you wish to change how the headers or footers look, these can be found in the site view folder since the Site controller handles the global functions.

File names

Within each folder, you will see regular files and some that begin with an underscore character, such as _cartitems.php. Any file that begins with an _ character is a small, very specific piece of a page that's included in some other view file (through Yii's renderPartial() command. For example, _cartitems contains code that renders the table of products that have been added to the cart. It is used in both the index and checkout pages. Some view files contain only javascript code, such as _googleconversion so there's nothing within them that really needs to be formatted.

We recommend that you follow a similar naming structure for any other files you create.

Clone this wiki locally