210 likes | 362 Views
Overview of Framework. by Ahamed Rifaudeen A. Steps before entering into the Framework?. Required Knowledge?. Basic knowledge of object-oriented programming (OOP) in php5 Database programming (Mysql, Sqlite3)
E N D
Overview of Framework by Ahamed Rifaudeen A
Steps before entering into the Framework? Required Knowledge? • Basic knowledge of object-oriented programming (OOP) in php5 • Database programming (Mysql, Sqlite3) • These are things that makes you the better understanding the frameworks easily. page - i
Cms Vs Framework Cms • Cms (Content-Management-System) is a type of Framework, • But generally limited towards making website with article/page type content with an out of the box article management system. • Mostly of the cms are focused on article management system. Framework • A Framework provides often used web development boilerplate code. • They can... • MVC paradigm • URL parsing and handling • Templating • Better request handling page - ii
What is Framework? Definition: • A set of reusable libraries or classes for a software is generally called as Frameworks • Model-View-Controller (MVC) • Push-based vs. pull-based • Three-tier organization Types of Framework: page - 1
Model-View-Controller (MVC) Model: • Consist of any business logics • Ex: database connection, user authentication, and etc.., View: • Consist of site layouts, and designs • Ex: html files Controller: • Controls the model and view • Decides Which model needed and which content is to be shown page - 2
Yii Framework Yii is a high-performance light weight framework Yii Stand for – Yes It Is Yii Framework is a Open Source Framework Yii Framework implements MVC Architecture Yii introduces a front controller called Application Application collects information about a user request and dispatch it to an appropriate controller Version 1.1.13 is the current stable version Download @ www.yiiframework.com page - 3
Installing and Configuring Yii Installing Yii Framework • Extract Downloaded Zip file into your server root • Ex: Save @ C:\wamp\www\ Configuring Yii Framework • Set environment variables • Append php path (C:\wamp\bin\php\php5.2.6) with path in the Environment Variables page - 4
Creating a new application With Command Prompt • Change directory to your framework root page - 5
Contd.. • Type yiic page - 6
Contd.. Syntax: yiic webapp path/to/demoProject • Ex: yiic webapp C:\wamp\www\demoProject Testing our demoProject • Locate the browser wihhttp://localhost/demoProject/ • Our project available with four menu page - 7
Structure of Yii Application • Index.php the bootstrap file • Application the front controller • App components used by our application • Controller controlling model and views • Model contains business logics, database and other inputs collected through forms • View contains user interface • Widget probably embeded in view files mainly for presentational purpose page - 8
Application workflow User requests http://www.webrobo.in/index.php?r=post/show&id=1 Application object created. Application gets information about request. Application determines the requested controller and action. Application creates an object of requested controller. Action reads a post model whose ID is 1 Action renders a view View reads and display data from post model View execute some widgets View embeds the result in a layout Action completes the rendering and display result to the user page - 9
Yii Framework Folder Structure Our Project folder contains 5 folders page - 10
Protected/ Protected folder is a base folder contains 12 sub folders page - 11
Contd.. page - 12
Important Folders of Yii Framework Inside Protected folder • Config • Controllers • Models • Views page - 13
Config/ Contains Application Configuration file • main.php is the application configuration file • Contains application level configurations such as application path, name, database configuration and etc.., page - 14
Controllers/ Contains our controllers D • File name must be same as class name • All Controllers must starts with Capital letter and end with Controller • All controller classes must extends Controller class (located @ located at protected/ components/Controller.php ) • Example: For site controller File name: SiteController.php Class name: SiteController page - 15
Models/ Contains ContactForm, LoginForm and our database models etc.., • ContactForm used by SiteController to manage contact form data. • LoginForm used by SiteController to manage login action. • And other Models Files(database). • All Business logics are resides here. page - 16
Views/ Contains View files for each controllers and layout of the website • Each Controller has its view files . • Controller name is Same as the folder name except the word Controller. • Layout files are reside inside layout folder. page - 17
Eof Overview Thank You... page - 1