Change the CakePHP instruction Homepage

Source: Internet
Author: User
Premise: You already? What are the advantages ?? Yes, if ?? Yes ?,?? : CakePHP 1.2? Yi 'an ??? Set
I. CakePHP object ?? Ming:
In? Before running the program, how does CakePHP arrange the program ?. Basically, Version 1.1 and version 1.2? What? Poor ?.
App
Cake
Docs
Index. php
Vendors

APP: mainly for you? Station Program ??? HTML ??.
Cake: the core program of CakePHP ,? Yes ???, You can also go ??? Disassemble the CakePHP program. Why? Currently, what about CakePHP? Ming? Not very complete, yes ?? How do I need to disassemble the program? Learn how to use it.
Docs :? Mingsi ?, Just put some CakePHP? .
Vendors: if you have other open source kits, you can place them in ?? Location.

App? ? :
Config: put? OK? ?, Yes? CakePHP 1.2? Yi 'an ??? Yes.
Controllers: What is the Controller program ?, What do you know? Is it controller? ?? Exam: CakePHP? Ming-Controller
Locale: Put more ?? Words? Information? Yes ?,?? It is also a new function of CakePHP 1.2.
Models: What is the purpose of the model program ?, What do you know? Is model? ?? Exam: CakePHP? Ming-Model
Plugins: put? Persons? Good CakePHP program.
TMP :? Mingsi ?, Put some? Save? ?, Including log and cache.
Vendors: The same as vendors.
Views: put? Category of the street program type ?.?? Exam: CakePHP? Ming-View
Webroot: Put ???? ??, Include? Slice, JavaScript, CSS, etc.

? Exam ?? : Http://book.cakephp.org/view/19/cakephp-file-structure

Ii .? Start with your first? Program: home_controller.php
First, under your_cakephp1.2/APP/controller? Why ?? The name is home_controller.php (? Why is the name_controller. php method ?? It's from CakePHP ??,? Just do it !),? The content is as follows:
<? PHP
Class homecontroller extends appcontroller {
Public $ name = 'home ';
Public $ uses = NULL;
// Start?
Public Function Index (){
} // End Index
}
?>

Under your_cakephp1.2/APP/views ,? Why? Object? Is home, under your_cakephp1.2/APP/View/home ,? Why ?? The name is index. CTP (? : 1.1 vice? Name is. thtml, 1.2 is. CTP ). Index. CTP? The content is as follows:
<Div>
<? PHP
Echo 'Hello world ';
?>
</Div>

After the program is completed ,? Under APP/config, modify routes. php ?? Router: connect ('/', array ('controller' => 'pages ', 'Action' => 'display', 'home'); to router :: connect ('/', array ('controller' => 'home', 'Action' => 'index', 'index'); what's next ??? No, it's basically not needed. Can you fix it ?? Solution!

Complete the above steps ?, Again ?? Your? Station, you can see your first? ? Yes. No? Edition? It's strange, mainly because ?? In the release box? Is the form of CakePHP .? Copy your_cakephp1.2/cake/libs/layouts/Default. CTP to your_cakephp1.2/APP/views/layouts. The original default. CTP? The content is as follows:
<? PHP

?>
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Title>
<? PHP _ ('cakephp: The rapid development PHP framework: ');?>
<? PHP echo $ title_for_layout;?>
</Title>
<? PHP
Echo $ HTML-> charset ();
Echo $ HTML-> Meta ('icon ');
Echo $ HTML-> CSS ('cake. Generic ');
Echo $ scripts_for_layout;
?>
</Head>
<Body>
<Div id = "Container">
<Div id = "Header">
<H1> <? PHP echo $ HTML-> Link (_ ('cakephp: The rapid development PHP framework', true), 'HTTP: // cakephp.org ');?> </H1>
</Div>
<Div id = "content">
<? PHP
If ($ session-> check ('message. flash ')):
$ Session-> flash ();
Endif;
?>
<? PHP echo $ content_for_layout;?>
</Div>
<Div id = "footer">
<? PHP echo $ HTML-> Link (
$ HTML-> image('cake.power.gif ', array ('alt' => _ ("CakePHP: The rapid development PHP framework", true ), 'border' => "0 ")),
'Http: // www.cakephp.org /',
Array ('target' => '_ new'), null, false
);
?>
</Div>
</Div>
<? PHP echo $ cakedebug;?>
</Body>
</Html>
Which? Index. CTP, OK? Is it a. php program, can there be HTML and PHP programs ?.

Header? Program? :
<? PHP _ ('cakephp: The rapid development PHP framework: ');?> ? Can one row be used? Except ,?? Title? No? Not me ?? Station? .
<? PHP echo $ title_for_layout;?> ? Keep, so one ?, Every? The Controller action can be set by itself ??? .? If not ?, Or? In addition, directly fill in your? Site title.
Echo $ HTML-> charset (); create? Reserved ,? Go? Take app. encoding of core. php? Set (?? Is UTF-8 ).
Echo $ HTML-> Meta ('icon '); favicon? Yes, yes? Except, change to your own
Echo $ HTML-> CSS ('cake. Generic '); CSS? Yes, yes? In addition, change to your own.
Echo $ scripts_for_layout; JavaScript program, OK? Division.

Body? Program? :
Except <? PHP echo $ content_for_layout;?> And can all others replace? Into your own? . <? PHP echo $ content_for_layout;?> Mainly CakePHP? Rational edition ?? Used, that is? ?? Index. CTP? Capacity. In addition, <? PHP echo $ cakedebug;?> Also created? Retained ?? Mode (configure: Write ('debug', 3) in core. php ))?,?? Show all ??? Rong ,? Changed to the release mode? (Configure: Write ('debug', 0) in core. php )),?? Yes No ?? Show any? Rong!

If the above steps are completed ?, Already? Change? First? Now!
Original article http://otaku.kigi.tw/2008/03/cakephp-12-cakephp.html#php Column

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.