CakePHP 1.2 HTMLHelper Examples
时间:2007-11-13 来源:liuxingyuyuni
CakePHP 1.2 HTMLHelper Examples
Posted here are live examples. Both the generated code and the rendered examples are running live on this server.
docType
You write this …
docType('html4-trans'); ?>
… and CakePHP returns this …
which sets the DocType for your site.
meta
You write this …
meta('favicon.ico','/favicon.ico',array('type'=>'icon')); ?>
… and CakePHP returns this …
which serves up the favicon for your site.
charset
You write this …
charset('utf-8'); ?>
… and CakePHP returns this …
which sets the charset for your site.
link
You write this …
link('CakePHP Home','http://www.cakephp.org'); ?>
… and CakePHP returns this …
CakePHP Home
… which renders (as I have it styled) as this:
CakePHP Home
You write this …
link($html->image('donut.gif',array('alt'=>'Donuts are Yummy!','border'=>'0')),'/',false,false,false);; ?>
… and CakePHP returns this …
… which renders (as I have it styled) as this:
css
You write this …
css('donutczar'); ?>
… and CakePHP returns this …
which loads the styles for your page.
style
You write this …
style(array('color'=>'#00f','text-align'=>'justify')); ?>
… and CakePHP returns this …
style="color:#00f; text-align:justify;"
… which renders (as I have it styled) as this:
style=”color:#00f; text-align:justify;”
addCrumb
getCrumbs
You write this …
addCrumb('CakePHP','http://www.cakephp.org'); ?>
You write this …
addCrumb('CakePHP Manual','http://manual.cakephp.org'); ?>
You write this …
getCrumbs(' | '); ?>
… and CakePHP returns this …
CakePHP | CakePHP Manual
… which renders (as I have it styled) as this:
CakePHP
|
CakePHP Manual
image
You write this …
image('cake.icon.png',array('alt'=>'CakePHP icon')); ?>
… and CakePHP returns this …
… which renders (as I have it styled) as this:
tableHeaders
You write this …
tableHeaders(array('First Name','Last Name','Email'),); ?>
… and CakePHP returns this …
First Name Last Name Email
… which renders (as I have it styled) as this:
First Name
Last Name
tableCells
You write this …
tableCells(array('Dunnottar','Ceiteach','email')); ?>
… and CakePHP returns this …
Dunnottar Ceiteach email
… which renders (as I have it styled) as this:
Dunnottar
Ceiteach
div
You write this …
div('notice','You should be using CakePHP!'); ?>
… and CakePHP returns this …
You should be using CakePHP!
… which renders (as I have it styled) as this:
You should be using CakePHP!
para
You write this …
para('advice','You should be using CakePHP!'); ?>
… and CakePHP returns this …
You should be using CakePHP!
… which renders (as I have it styled) as this:
You should be using CakePHP!
相关阅读 更多 +
排行榜 更多 +