Upload
samuel-morrison
View
219
Download
0
Tags:
Embed Size (px)
Citation preview
Overview of Framework by
Ahamed Rifaudeen A
page - i
Steps before entering into the Framework?
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.
Required Knowledge?
page - ii
Cms Vs Framework
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.
Cms
A Framework provides often used web development boilerplate code.
They can...
MVC paradigm
URL parsing and handling
Templating
Better request handling
Framework
page - 1
What is Framework?
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
Definition:
Types of Framework:
page - 2
Model-View-Controller (MVC)
Consist of any business logics
Ex: database connection, user authentication, and etc..,
Model:
View: Consist of site layouts, and designs
Ex: html files
Controls the model and view
Decides Which model needed and which content is to be shown
Controller:
page - 3
Yii Framework
Yii is a high-performance light weight framework
Yii Stand for – Yes It Is
Yii Framework is a Open Source Framework
Download @ www.yiiframework.com
Yii Framework implements MVC Architecture
Version 1.1.13 is the current stable version
Yii introduces a front controller called Application
Application collects information about a user request and dispatch it to an appropriate controller
page - 4
Installing and Configuring Yii
Extract Downloaded Zip file into your server root
Ex:
Save @ C:\wamp\www\
Installing Yii Framework
Configuring Yii Framework
Set environment variables
Append php path (C:\wamp\bin\php\php5.2.6) with path in the Environment Variables
page - 5
Creating a new application
Change directory to your framework root
With Command Prompt
page - 6
Contd..
Type yiic
page - 7
Contd..
Ex: yiic webapp C:\wamp\www\demoProject
Syntax: yiic webapp path/to/demoProject
Testing our demoProject Locate the browser wih http://localhost/demoProject/
Our project available with four menu
page - 8
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 - 9
Application workflow
1. User requests http://www.webrobo.in/index.php?r=post/show&id=1
2. Application object created.3. Application gets information about
request.4. Application determines the requested
controller and action.5. Application creates an object of requested
controller.6. Action reads a post model whose ID is 17. Action renders a view8. View reads and display data from post
model9. View execute some widgets10.View embeds the result in a layout11.Action completes the rendering and display
result to the user
page - 10
Yii Framework Folder Structure
Folder Description/Contains
Assets/ Published resources
Css/ Css files
Images/ Image files
Protected/ Application Files
Themes/ Application themes
Our Project folder contains 5 folders
page - 11
Protected/
Protected folder is a base folder contains 12 sub folders
Folder Description/contains
Commands/ Customized yiic commands
Components/ Reusable user components
Config/ Configuration files
Controllers/ Controller files
Data/ Database oriented files
Extensions/ 3rd party extensions
Messages/ Translated messages
Migrations/
Models/ Model files (our business logics)
page - 12
Contd..
Folder Description/Contains
Runtime/ Temporarily generated files
Tests/ Test scripts
Views/ View and layout files
page - 13
Important Folders of Yii Framework
Config
Controllers
Models
Views
Inside Protected folder
page - 14
Config/
main.php is the application configuration file
Contains application level configurations such as
application path, name, database configuration and etc..,
Contains Application Configuration file
page - 15
Controllers/
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
DContains our controllers
page - 16
Models/
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.
Contains ContactForm, LoginForm and our database models etc..,
page - 17
Views/
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.
Contains View files for each controllers and layout of the website
page - 1
Eof Overview
Thank You...