Cakephp Classroom image

pankaj
 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26|Last
Lessons:-Controllers

http://example.com/admin/controller/add
http://example.com/admin/controller/delete
This is an easy way to create a simple backend interface quickly. Keep in mind that you cannot have both
admin and non-admin methods scaffolded at the same time. As with normal scaffolding you can override
individual methods and replace them with your own:
public function admin_view($id = null) {
// custom code here
}
Once you have replaced a scaffolded action you will need to create a view file for the action as well.
Customizing Scaffold Views
If you’re looking for something a little different in your scaffolded views, you can create templates. We still
don’t recommend using this technique for production applications, but such a customization may be useful
during prototyping iterations.
Custom scaffolding views for a specific controller (PostsController in this example) should be placed like
so:
/app/View/Posts/scaffold.index.ctp
/app/View/Posts/scaffold.form.ctp
/app/View/Posts/scaffold.view.ctp
Custom scaffolding views for all controllers should be placed like so:
/app/View/Scaffolds/index.ctp
/app/View/Scaffolds/form.ctp
/app/View/Scaffolds/view.ctp
The Pages Controller
CakePHP ships with a default controller PagesController.php. This is a simple and optional controller
for serving up static content. The home page you see after installation is generated using this controller.
If you make the view file app/View/Pages/about_us.ctp you can access it using the url
http://example.com/pages/about_us. You are free to modify the Pages Controller to meet your
needs.
When you “bake” an app using CakePHP’s console utility the Pages Controller is
created in your app/Controller/ folder. You can also copy the file from
lib/Cake/Console/Templates/skel/Controller/PagesController.php.
Changed in version 2.1: With CakePHP 2.0 the Pages Controller was part of lib/Cake.
Since 2.1 the Pages Controller is no longer part of the core but ships in the app folder.
Warning: Do not directly modify ANY file under the lib/Cake folder to avoid issues when updating
the core in future.Components
Components are packages of logic that are shared between controllers. If you find yourself wanting to copy
and paste things between controllers, you might consider wrapping some functionality in a component.
CakePHP also comes with a fantastic set of core components you can use to aid in:
• Security
• Sessions
• Access control lists
• Emails
• Cookies
• Authentication
• Request handling
• Pagination
Each of these core components are detailed in their own chapters. For now, we’ll show you how to create
your own components. Creating components keeps controller code clean and allows you to reuse code
between projects.

 
 
 

pankaj

Skills    Cakephp

Qualifications :-
Location :-,,,
Description:-
Explore
 

  Students (0)