Thursday, 17 April 2014

Yii Framework Tutorial Set 2

cont......

       Before reading this post you must read my previous post Yii Framework Tutorial Set 1. Its been a long time i am writing this post, because i was busy with my Yii projects. In the previous post you have successfully installed Yii framework application. You can check it at this below url:

http://localhost/firstapp/index.php
 
If everything is Ok, it will be like this.
 
Source: yiiframework.com
 
You can change the contents of this home page at
protected/views/site/index.php .
in the same way you can edit about us page at
protected/views/site/pages/about.php
contact us page at
protected/views/site/contact.php
log in page at
protected/views/site/login.php
and finally error page at
protected/views/site/error.php


YII CHANGE APP NAME:

           In default, The application name will be "My Web Application". You can change this to your preferred name at protected/config/main.php . You have to change the 'name' parameter in array. In the same file you have to change Database details also. In default, DB connection is connected to SQLITE database. So, you must change the DB Details also.
 

YII LAYOUT:

        Do you confused by thinking from where this layout came? The main layout files for yii framework is in  protected/views/layouts/ .
at this layouts folder you can see three different files as below.
  • main.php
  • column1.php
  • column2.php
It means in default we have two different layout at present (You can also add layout files and modify these two files based on you view). As the name suggests the difference between these two layout is first one is single column and second is double column with sidebar. Where does the layout file is selected?      The layout for particular page or view can be selected in their respective controller file. For instance, in controllers/sitecontroller.php we have variable $layout. In this variable we have to specify either column1 or column2 (note: don't use column1.php and column2.php, Yii will point this automatically. In the same way at any situation in you want to include any file don't use php extension).

YII FRAMEWORK CSS STYLING:

         When you open these layout files, index.php, contact.php all html elements will use blueprint css framework. I prefer you to go through this blueprint css at their official website http://www.blueprintcss.org. for your reference i will give you one example:
          To design a DIV with 590px you can specify class name as span-15. 
So, you don't need to write your own css for each and every html elements. Once again i am asking you to read about blueprint css framework to design your application effectively.        

 

       

3 comments:

  1. Hi! I'm also a PHP Developer, The above blogging information is very useful to Us...

    Yii Support

    ReplyDelete


  2. I'm also a Developer but i'm adult stage in this Development, Thank you for your info, It was very useful to me...

    Yii Framework Development Company India

    ReplyDelete
  3. Nice information. Thanks for sharing content and such nice information for me. I hope you will share some more content about. Please keep sharing!
    Outsource Yii Application Development

    ReplyDelete