: MVC Framework ( ii), xhtml, CSS, PHP5,mySQL XML AJAX (jquery)

. o "Yii" PHP. framework : : : 04/2674 2014 . - , . . broadband . browsers, internet” Online internet. Internet , , cloud. 2 , , , ,...
Author: Silvester Horn
8 downloads 0 Views 1MB Size
.

o "Yii" PHP.

framework

:

:

: 04/2674

2014

.

-

, .

.

broadband . browsers, internet” Online internet. Internet

,

,

cloud. 2 ,

,

,

,

,

.

frameworks , . framework

Yii.

PHP,

, , .

,

Yii Framework web

.2

118

, .

.

-

Yii Framework

.

Yii

MVC (Model-View-Controller).

.

, . carpooling.

: MVC Framework ( ii), xHTML, CSS, PHP5 ,mySQL XML AJAX (jQuery) .

: PHP, MVC Framework, HTML, CSS, Carpooling

.3

118

.

-

Abstract This thesis content is an introduction to the features and abilities of ii Frameork and the development of an application with it. Yii is based on MVC (Model-View-Controller) architecture. This design pattern helps to keep the source code well organized so that to be easier to read and cultivated. The application which will be developed will be a platform where users can share their car rides, so that other users who want to have the same ride can contact them, travel together and share the cost. This way of traveling is known as carpooling. For completing this development a bunch of technologies and tools is going to be needed. Such as MVC Framework ( ii), xHTML, CSS, PHP5 ,mySQL XML AJAX (jQuery)

.

Key words: PHP, MVC Framework, HTML, CSS, Carpooling

.4

118

.

-

,

. ,

.

,

. .

“…

: …”

. .

.5

118

.

1

-

-

O

1: 1.1 1.2 HTML 1.3 CGI 1.4

(WORLD WIDE WEB)

2: H PHP 2.1 2.2 2.3 2.4 3.1 3.2 3.3

PHP PHP 3: MYSQL MYSQL MYSQL MYSQL 4: PHP FRAMEWORKS

4.1 4.2

PHP FRAMEWORKS

2

5:

5.1 5.2

YII FRAMEWORK YII FRAMEWORK

J QUERY UI)

.6

9 9 11 20 22 24 24 25 26 29 33 33 33 34 36 37 39 44

YII

6: 6.1 MVC DESIGN PATTERN 6.2 6.3 YIIC 6.4 GII 6.5 7: 7.1 DATABASE ACCESS OBJECTS (DAO) 7.2 QUERY BUILDER 7.3 ACTIVE RECORD 7.4 RELATIONAL ACTIVE RECORDS 7.5 NAMED SCOPES 7.6 DB MIGRATION 8: YII 8.1 8.2 (ZII 9: 9.1 CACHING 9.2 URL MANAGEMENT 9.3 9.4

8

118

45 45 45 47 47 54 55 58 63 67 67 69 70 73 75 76 79 79 85 93 93 94 94 95

. 3

- TO YII

96 10:

10: 10.1 10.2 10.3 11: 11.1 11.2 11.3 12: 12.1 12.2 12.3 12.4 12.5 12.6 12.7 12.8 12.9

YII . MODELS MODULE

CONTROLLERS

GII.

.

CONTROL PANEL MENU

.7

118

96 97 97 97 97 99 99 99 100 102 102 103 106 108 109 111 112 115 116

.

-

1

(Web Programming)

.8

118

.

-

1: , ,

(World Wide Web)

1990.

web

cloud

.

web

,

.

1.1

(World Wide Web) 1980

Tim Berners-Lee

HyperText (

)

Internet (

) .

,

.

CERN 1990,

World Wide Web.

(=web)”

“HyperText

” “

(=browser)”

. To client-server(=

).

1990

browser ( client), ,

web server, ,

project.

World Wide Web . :

web server(=web

),

,

-

-

web server

browser. web server . ,

browser

.9

118

.

.

-

browser .

3

:

1.

Internet.

2.

Web Server

Browser.

3.

.

3 1.

Tim Berners-Lee: UDI,

Universal

Document

Identifier

(

)

URI

URL :

>://

>/

> 2. To

“HTTP”, HyperText Transfer Protocol. web

server 3.

client.

HTML, HyperText Markup Language .

,

World Wide

Web . , World Wide Web

HTML. Web

, desktop desktop (=

. Web

“cloud”

,

Internet , e-mail managers,

, Web

. 10

).

118

.

-



Internet-

.

Web:

, ,

,

,

,

, ,

“e-“ (e-banking, e-shop

.

).

World Wide Web

23 . . ,

. .

,

,

,

“e-“

.

1.2 HTML

HTML

HyperText

Markup

Language

(=

) .

SGML

(Standard Generalized Markup Language)

IBM

. browser html. HTML

HTML

,


( (tags) HTML



), .

. 11

118

HTML

.

,

. web browser

HTML .

browser

HTML, . HTML elements. : 1. (“body”)

, 2. , . HTML ,

: «

»

«

»,

, , .

HTML .

«
. ,

HTML

:

content. HTML

,

.

HTML .

«/»,

.

,

, . :

. 12

118

.

-

Hello HTML Hello World!

(





,



.

'Hello HTML' browser.).

Document Type Declaration

HTML5.

HTML.

1.2.1 : < ! --...-->

. browser.




.

...

.

.

.

.

.

...

.

.

. .

...

1

I

6 (hi - h6).

...< / fo nt >

.



.

...

.

...

.

...

. . 13

118

.

1.2.2 :

-

(

)

...< /ul>

.

...< /ol>

.

...

.

...< /dl>

.

...

.

...

.

1.2.3: ...

. attribute «href».

1.2.4 : < img>...

. (

...

) .

1.2.5: ...

.

...

.

...

.

...

.

1.2.6: ...< /fra meset>

.

...

.

1.2.7: < form>...

.

< input >...

..

...

.

. 14

118

.

-

...

.

...

.

POST

HTTP.

GET URL

.

html

? .

https://www.teithe.gr/index.html?department=it. 1.2.1 JavaScript

JavaScript

(script

language) HTML

.

(interpreted language),

scripts .

Brendan Eich

1996,

1997

browsers (standardization)

ECMA Organization. JavaScript

(statements)

browser

.

JavaScript statement

browser, .

JavaScript ,

HTML

,

script

. HTML

(validate)

,

server.

JavaScript

browser

browser browser, cookies, .

. 15

118

.

JavaScript

HTML



"type" script

.

...

JavaScript. JavaScript

script

browser

.

html To script element

:

function “displayDate()” id=demo tags

browser

.innerHTML

,

.

click

, element button

function “dislpalyDate()”.

function displayDate() { document.getElementById("demo").innerHTML=Date( ); } ! , . .

1.2.2 CSS CSS

Cascading Style Sheets, .

HTML 4.0 . 16

118

.

-

. HTML . style sheets . , .

,

style sheets (

),

.

(cascade)

'

(virtual)

,

:

1)

browser.

2)

(External Style Sheet).



3)

(Internal Style Sheet),



. hr {color:red;} p {margin-left:20px;} body {background-image:url("images/backimg.gif");}

. 17

118

.

-



4) Inline Style,

HTML

.

.

CSS

:

(property)

(value) {

(selector),

:

:

}

selector {property: value}

,

.

“:” "{"

"}",

:

body {color: black}

,

:

p {font-family: "courier new"}

, “;”

:

p {text-align: center; color: blue}

, . .

:

. 18

118

.

hi,

-

h2,

h3,

h4,

h5, h6 {

color: red }

(attribute) class . , . :

p.right

{text-align: right} p.center {text-align:

center}

class ,

:

. . . .

id . : #right

{text-ali gn: right}

HTML

:

. 19

118

HTML

.

-

. . . .



1.3 CGI HTML

. server, ( server

browser

JavaScript). , CGI ”

Common Gateway Interface.

HTML

CGI

,

web. CGI

web server . .

CGI scripts,

,

C, Perl,

Python, Visual Basic batch files scripts

Unix.

,

windows

Perl

strings

CGI . CGI

web server . string . 20

118

bash

.

-

HTML

.

web server

CGI

browser .

HTML

.

2

web server

.

POST

GET. URL

script

query string (

GET) ,

, script

module.

Apache

module ) ,

parser .

. 21

118

, PHP (

.

-

1.4

,

CGI,

web,

. , .

; , ,

.

, ,

. (

.

.

,

,

)

)

. , ,

:

/

.

,

,

. 22

118

.

, .

. ,

,

DataBase Mangement System, DBMS.

web CGI Script)

PHP ( MySQL (

DBMS). .

(

. Char, int, date)

(primary key),

(unique). , , .

,

(foreign keys), , ,

site.

. 23

118

2: H PHP

web

:

o Python o Perl o JSP o ASP o Ruby PHP ( Yii).

web

.

PHP.

2.1

PHP

1994,

,

Lerdorf

Rasmus Perl

CGI script

php.cgi,

online

.

.

script

script

, . Page/Form Interpreter.

PHP/FI 1997 C

PHP/FI

Personal Home 2.0, 50.000

.

,

Gutmans

Andi

Zeev Suraski

,

PHP/FI 2.0.

PHP

3.0 .

,

Zeev

Zend (

Andi

), PHP.

1998

4

PHP,

2004

5, PHP 6, . 4

2.2

5

PHP.

PHP PHP

(

web server, (

1.1)

. Apache),

HTML

, HTML. ,

;

.

HTML

.

Example