Difference between #1 and #2 of
Front-end developer's guide

Revision #2 has been created by waitekk on Feb 27, 2012, 3:21:50 PM with the memo:

Fixed some typos
« previous (#1)


Title unchanged

Front-end developer's guide

Category unchanged


Yii version unchanged

Tags unchanged

front-end, views, layouts, chtml, CClientScript

Content changed

This wiki is targeted at developers that are new to Yii and are focusing on developing the front-end of a Yii application using languages such as HTML, CSS and JavaScript. Perhaps there are different developers working on the backend, but you are focused on the front-end. There are certain things you need to do to keep your code manageable for those backend developers. This article is meant to teach you those things.

As a front-end developer, you will be focusing mainly on implementing views. Views are simply *.php files that contain mostly html which is sent to the browser. They may be embedded in layouts, which is very similar to a view itself. Layouts generally define the outside framework of a website, while the views define the content on the individual pages. View are contained in the `protected/view
s` directory, and are organized by `controller` (`controllers` are like categories that views with similar purposes reside - for instance a blog post list and blog post create view may be in a `blog` controller). Layouts are contained in the `protected/views/layouts` directory. Layouts may even be embedded in other layouts.

For instance, the `view` file for the front page is likely at `/protected/views/site/index.php`, as the front page is the `index` action in the `site` controller by default.

You can use the CHtml helper to render certain html elements. This should especially be done for links and forms. Please [read this](http://www.yiiframework.com/wiki/48/by-example-chtml "CHtml examples") for code examples of CHtml.
10 0
Viewed: 29 108 times
Version: 1.1
Category: Tutorials
Written by: jonah
Last updated by: waitekk
Created on: Dec 8, 2011
Last updated: 6 years ago
Update Article


View all history