SlideShare a Scribd company logo
1 of 36
Top 50
Interview Questions & Answers
in
CakePHP
2
Top 50 Interview Questions & Answers in CakePHP
Question : 1 What is CakePHP?
 CakePHP is a free, open-source, rapid development
framework for PHP. It’s a foundational structure for
programmers to create web applications. CakePHP goal
is to enable developers to work in a structured and rapid
manner–without loss of flexibility. CakePHP takes the
monotony out of web development.
3
Top 50 Interview Questions & Answers in CakePHP
Question : 2 When CakePHP was Developed?
 CakePHP started at april 2005.When a Polish
programmer Michal Tatarynowicz wrote a minimal
version of a Rapid Application Framework in PHP,
dubbing it Cake.Cake php version 1.0 released in May
2006. (source:http://en.wikipedia.org/wiki/CakePHP)
4
Top 50 Interview Questions & Answers in CakePHP
Question : 3 What is the current stable version of CakePHP?
 2.5.4 (Released on 2014-09-02)
Question : 4 What is MVC in CakePHP?
 Model view controller (MVC) is an architectural pattern
used in software engineering.
Model: Database functions exist in the model
View: Design parts written here
Controller: Business Logic goes here
For Detail : MVC Architecture
5
Top 50 Interview Questions & Answers in CakePHP
Question : 5 Server requirements for CakePHP.
 An HTTP server (like Apache) with the following
enabled:
- Sessions
- mod_rewrite
 PHP 4.3.2 or greater. Yes, CakePHP works great in
either PHP 4 or 5.
 A database engine (right now, there is support for
MySQL 4+, PostgreSQL and a wrapper for ADODB).
6
Top 50 Interview Questions & Answers in CakePHP
Question : 6 How to Install CakePHP?
Step1: Go to cakephp.org and download the latest version of
cakephp.
Step2: Cakephp comes in a .zip file,so unzip it.
Step3: Extract the files in the localhost in the desired folder
(for example:cakephp).
Step4: Open the browser and run the URL localhost/cakephp
Step5: Just Follow the instructions display on the page.
7
Top 50 Interview Questions & Answers in CakePHP
Question : 7 What is the folder structure of CakePHP?
cakephp/
app/
Config/
Console/
Controller/
Lib/
Locale/
Model/
Plugin/
Test/
tmp/
Vendor/
View/
webroot/
.htaccess
index.php
lib/
plugins/
vendors/
.htaccess/
index.php/
README.md/
8
Top 50 Interview Questions & Answers in CakePHP
Question : 8 What is the name of CakePHP database configuration file name
and its location?
 Default file name is database.php.default.
Its located at "/app/config/database.php.default".
To connect with database it should be renamed to
database.php
Question : 9 What is the first file that gets loaded when you run a
application using CakePHP? Can you change that file?
 bootstrap.php
yes it can be changed. Either through index.php , or
through .htaccess
9
Top 50 Interview Questions & Answers in CakePHP
Question : 10 What is the use of Security.salt and Security.cipherSeed in
CakePHP? How to change its default value?
 The Security.salt is used for generating hashes. We
can change the default Security.salt value in
/app/Config/core.php.
 The Security.cipherseed is used for encrypt/decrypt
strings. We can change the default Security.cipherSeed
value by editing /app/Config/core.php.
10
Top 50 Interview Questions & Answers in CakePHP
Question : 11 What are controllers?
 A controller is used to manage the logic for a part of your
application. Most commonly, controllers are used to
manage the logic for a single model. Controllers can
include any number of methods which are usually
referred to as actions. Actions are controller methods
used to display views. An action is a single method of a
controller.
11
Top 50 Interview Questions & Answers in CakePHP
Question : 12 What is default function for a controller?
 index() function
 function beforeFilter()
Question : 13 Which function is executed before every action in the
controller?
12
Top 50 Interview Questions & Answers in CakePHP
Question : 14 Using CakePHP, what all are drawbacks?
 It loads full application before it starts your task. Its not
recommended for small projects because of its resource
heavy structure.
13
Top 50 Interview Questions & Answers in CakePHP
Question : 15 List some of the features in CakePHP.
 Compatible with versions 4 and 5 of PHP
 MVC architecture
 Built-in validations
 Caching
 Scaffolding
 Access Control Lists and Authentication.
 CSRF protection via Security Component.
14
Top 50 Interview Questions & Answers in CakePHP
Question : 16 What is the naming convention in CakePHP?
 Table names are plural and lowercased
 Model names are singular and CamelCased: ModelName,
model filenames are singular: ModelName.php
 Controller names are plural and CamelCased with
*Controller* appended: ControllerNamesController,
controller filenames are plural and *Controller* appended:
ControllerNamesController.php
15
Top 50 Interview Questions & Answers in CakePHP
Question : 17 What is Scaffolding in Cakephp?
 Scaffolding is a technique that allows a developer to
define and create a basic application that can create,
retrieve, update and delete objects.
Question : 18 How to add Scaffolding in your application?
To add scaffolding to your application, just add the $scaffold variable in the controller,
<?php
class PostsController extends AppController {
var $scaffold;
}
?>
Assuming you’ve created Post model class file (in /app/Model/post.php),
you’re ready to go. Visit http://example.com/posts to see your new scaffold.
16
Top 50 Interview Questions & Answers in CakePHP
Question : 19 What is a Component in CakePHP?
 Components are packages of logic that are shared
between controllers. They are useful when a common
logic or code is required between different controllers.
Question : 20 What are commonly used components of CakePHP?
 Security
 Sessions
 Access control lists
 Emails
 Cookies
 Authentication
 Request handling
 Scaffolding
17
Top 50 Interview Questions & Answers in CakePHP
Question : 21 What is a Helper?
 Helpers in CakePHP are associated with Presentation
layers of application. Helpers mainly contain presentational
logic which is availabel to share between many views,
elements, or layouts.
Question : 22 What are commonly used helpers of CakePHP?
 FormHelper
 HtmlHelper
 JsHelper
 CacheHelper
 NumberHelper
 Paginator
 SessionHelper
 RSS
18
Top 50 Interview Questions & Answers in CakePHP
Question : 23 What is a Behavior?
 Behaviors in CakePHP are associated with Models.
 Behaviors are used to change the way models behaves
and enforcing model to act as something else.
Question : 24 What is the difference between Component, Helper and
Behavior?
 Component is a Controller extension,
 Helpers are View extensions,
 Behavior is a Model Extension.
19
Top 50 Interview Questions & Answers in CakePHP
Question : 25 What is a Element?
 Element in CakePHP are smaller and reusable bits of
view code. Elements are usually rendered inside views.
Question : 26 What is a layout?
 Layout in CakePHP are used to display the views that
contain presentational code. In simple,views are
rendered inside a layout.
20
Top 50 Interview Questions & Answers in CakePHP
Question : 27 How to set layout in the controller?
 var $layout = ‘layout_name’;
for a specific action, use below code in that action
 $this->layout =”layout_name”;
Question : 28 How to include helpers in controller ?
 public $helpers = array(‘Form’, ‘Html’, ‘Js’, ‘Time’);
for specific action, use below code in that action
 $this->helper[] =”helper_name”;
21
Top 50 Interview Questions & Answers in CakePHP
Question : 29 How to include components in controller ?
 public $components = array(‘Emails’, ‘ImageUploader’,
‘Sms’);
Question : 30 How to write, read and delete the Session in CakePHP?
 $this->Session->write(‘Bird.Color’, ‘Black’);
 $black = $this->Session->read(‘Bird.Color’);
 $this->Session->delete(‘Bird’);
22
Top 50 Interview Questions & Answers in CakePHP
Question : 31 What is the use of $this->set();
 The set() method is used for creating a variable in the view
file.Say for example if we write,
 $this->set('posts',$posts); in controller fie, then the variable
$posts will be available to use in the view template file for
that action.
Question : 32 What is the use of $this->set(compact());
 Using $this->set(compact()) , we can pass multiple
parameters to access into the view file.
For example,
$this->set(compact('posts','users','reports'));
 Now all these variables will be available in respective
view file.
23
Top 50 Interview Questions & Answers in CakePHP
Question : 33 What are the advantages of each? Which would you use and
why?
 An advantage with first case $this->set('posts', $posts);
is that it allows two different names for the view file and controller
file. For example, you could write something like
$this->set('postData', $posts); Now the variable name in the
view file would be $postData.
 The advantage with the second approach , $this->set(compact());
is easier to write, and useful especially when we are setting
several variables to the view.No need to add separate line for
each variable as we have with $this->set();
For example,
 $this->set(compact('posts','users','reports'));
24
Top 50 Interview Questions & Answers in CakePHP
Question : 34 Is it possible to have Multiple validation Rules per Field in
CakePHP?
 Yes its possible.
25
Top 50 Interview Questions & Answers in CakePHP
Question : 35 What is wrong with the below validation rule?
'email' => array(
'rule' => array(
'rule' => 'notEmpty',
'message' => 'Please Enter Email address.'
),
'rule' => array(
'rule' => 'email',
'message' => 'Entered Email address is invalid.'
)
)
26
Top 50 Interview Questions & Answers in CakePHP
Answer:
 The problem is the first rule notEmpty will never be called
because email rule will overwrite it.While using multiple
validation rules for the same field you must keep the rule
key "unique". In this case if we want to use multiple rules
then, we can simple change the rule key names like,
'email' => array(
'rule1' => array(
'rule' => 'notEmpty',
'message' => 'Please Enter Email address.'
),
'rule2' => array(
'rule' => 'email',
'message' => 'Entered Email address is invalid.'
)
)
27
Top 50 Interview Questions & Answers in CakePHP
Question : 36 What is the difference between required and notEmpty in
CakePHP?
 To understand this question read this post:
difference between required and notEmpty
Question : 37 How to Get current URL in CakePHP?
 To get current url in CakePHP use,
echo Router::url($this->here, true);
 This will give full URL with hostname. If you want to get relative
path instead of full URL, then use the following code:
echo $this->here;
 This will produce absolute URL excluding hostname i.e.
/controller/abc/xyz/
28
Top 50 Interview Questions & Answers in CakePHP
Question : 38 How can you make url’s search engine friendly while using
CakePHP?
 It's an automatic task that is done by CakePHP.
Question : 39 Can you list some database related functions in CakePHP?
 find, findAll , findAllBy , findBy , findNeighbours and
query.
29
Top 50 Interview Questions & Answers in CakePHP
Question : 40 Which methods are used to create and destroy model
associations on the fly?
 The bindModel() and unbindModel() Model methods are
used to create and destroy model associations on the fly.
Question : 41 What is the use of requestAction method?
 The method requestAction is used to call a controller’s
action from any location and returns data from the
action.
30
Top 50 Interview Questions & Answers in CakePHP
Question : 42 What is recursive in CakePHP?
 To understand this topic follow this post :
Recursive in CakePHP
Question : 43 How can we use ajax in CakePHP?
 By calling ajax helper and then using it in controller for
rendering.
31
Top 50 Interview Questions & Answers in CakePHP
Question : 44 What is habtm?
 Has and belongs to many is a kind of associations that can
be defined in models for retrieving associated data across
different entities.
Question : 45 How CakePHP URL looks in address bar?
 http://example.com/controller/action/param1/param2/p
aram3
32
Top 50 Interview Questions & Answers in CakePHP
Question : 46 How can you include a javascript menu throughout the site. Give
steps.
 By adding the javascript files in webroot and call them in
default views if needed everywhere or just in the related
views.
Question : 47 Why CakePHP have two vendor folder? what is the
difference between two vendors folder available in CakePHP?
 There will be two vendor folders available in CakePHP
framework. one in ” app ” folder and one in root folder
 The vendor folder in the app folder is used to place the
third-party libraries which are application specific.
 The vendor folder in the root folder is used to place the
third-party libraries which are used for multiple applications.
33
Top 50 Interview Questions & Answers in CakePHP
Question : 48 What is the default extension of view files in CakePHP? can we
change it? if yes then how?
 default extension of view files is '.ctp'.
 yes we can change it by writing public $ext = '.yourext'; in AppController.If you want to change it for
particular controller then add it into that controller only.You can also change it for the specific
action of the controller by putting it in that action of controller.
public $ext = '.yourext'; in AppController
- you can change all the views extentions.
public $ext = '.yourext'; in specific controller like, PostsController
- you can change all the views extentions of PostsController.
public $ext = '.yourext'; in specific controller action like, index()
- you can change the view extention of index.ctp
Note: You cannot specify multiple extensions, however it seems like there is a
fall back to .ctp if no .php file is found.
34
Top 50 Interview Questions & Answers in CakePHP
Question : 49 How can you set custom page title for the static page?
 To set a custom page title, copy-paste following code
anywhere in your static page (.ctp) file:
 $this->set("title_for_layout", "My page title");
Question : 50 How to display the schema of the model?
 If you want to display the schema of particular model
then you just need to add the following single line of
code.
 For example we have “Posts” Controller.
pr($this->Post->schema());
35
To learn more about CakePHP, start reading our CakePHP
Tutorials Series.
CakePHP Tutorials Series
36
PHP Dev Zone
Published by : www.php-dev-zone.com @phpdzone

More Related Content

What's hot

Quick flask an intro to flask
Quick flask   an intro to flaskQuick flask   an intro to flask
Quick flask an intro to flaskjuzten
 
Learn flask in 90mins
Learn flask in 90minsLearn flask in 90mins
Learn flask in 90minsLarry Cai
 
Fighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnitFighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnitJames Fuller
 
Django, What is it, Why is it cool?
Django, What is it, Why is it cool?Django, What is it, Why is it cool?
Django, What is it, Why is it cool?Tom Brander
 
Behaviour Driven Development con Behat & Drupal
Behaviour Driven Development con Behat & DrupalBehaviour Driven Development con Behat & Drupal
Behaviour Driven Development con Behat & Drupalsparkfabrik
 
Go swagger tutorial how to create golang api documentation using go swagger (1)
Go swagger tutorial how to create golang api documentation using go swagger (1)Go swagger tutorial how to create golang api documentation using go swagger (1)
Go swagger tutorial how to create golang api documentation using go swagger (1)Katy Slemon
 
LvivPy - Flask in details
LvivPy - Flask in detailsLvivPy - Flask in details
LvivPy - Flask in detailsMax Klymyshyn
 
PloneNG: What's new in Plone 4.2, 4.3, and beyond
PloneNG: What's new in Plone 4.2, 4.3, and beyondPloneNG: What's new in Plone 4.2, 4.3, and beyond
PloneNG: What's new in Plone 4.2, 4.3, and beyondDavid Glick
 
Python/Flask Presentation
Python/Flask PresentationPython/Flask Presentation
Python/Flask PresentationParag Mujumdar
 
Intro to CakePHP 1.3
Intro to CakePHP 1.3Intro to CakePHP 1.3
Intro to CakePHP 1.3Adam Culp
 
Flask Introduction - Python Meetup
Flask Introduction - Python MeetupFlask Introduction - Python Meetup
Flask Introduction - Python MeetupAreski Belaid
 
Php Conference Brazil - Phalcon Giant Killer
Php Conference Brazil - Phalcon Giant KillerPhp Conference Brazil - Phalcon Giant Killer
Php Conference Brazil - Phalcon Giant KillerJackson F. de A. Mafra
 
Creating a Plug-In Architecture
Creating a Plug-In ArchitectureCreating a Plug-In Architecture
Creating a Plug-In Architectureondrejbalas
 

What's hot (20)

Quick flask an intro to flask
Quick flask   an intro to flaskQuick flask   an intro to flask
Quick flask an intro to flask
 
Flask
FlaskFlask
Flask
 
Learn flask in 90mins
Learn flask in 90minsLearn flask in 90mins
Learn flask in 90mins
 
Fighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnitFighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnit
 
Django, What is it, Why is it cool?
Django, What is it, Why is it cool?Django, What is it, Why is it cool?
Django, What is it, Why is it cool?
 
Behaviour Driven Development con Behat & Drupal
Behaviour Driven Development con Behat & DrupalBehaviour Driven Development con Behat & Drupal
Behaviour Driven Development con Behat & Drupal
 
Nginx pres
Nginx presNginx pres
Nginx pres
 
Go swagger tutorial how to create golang api documentation using go swagger (1)
Go swagger tutorial how to create golang api documentation using go swagger (1)Go swagger tutorial how to create golang api documentation using go swagger (1)
Go swagger tutorial how to create golang api documentation using go swagger (1)
 
Cakephp manual-11
Cakephp manual-11Cakephp manual-11
Cakephp manual-11
 
Django Girls Tutorial
Django Girls TutorialDjango Girls Tutorial
Django Girls Tutorial
 
LvivPy - Flask in details
LvivPy - Flask in detailsLvivPy - Flask in details
LvivPy - Flask in details
 
PloneNG: What's new in Plone 4.2, 4.3, and beyond
PloneNG: What's new in Plone 4.2, 4.3, and beyondPloneNG: What's new in Plone 4.2, 4.3, and beyond
PloneNG: What's new in Plone 4.2, 4.3, and beyond
 
Python/Flask Presentation
Python/Flask PresentationPython/Flask Presentation
Python/Flask Presentation
 
Presentation laravel 5 4
Presentation laravel 5 4Presentation laravel 5 4
Presentation laravel 5 4
 
Laravel Unit Testing
Laravel Unit TestingLaravel Unit Testing
Laravel Unit Testing
 
Intro to CakePHP 1.3
Intro to CakePHP 1.3Intro to CakePHP 1.3
Intro to CakePHP 1.3
 
Flask Introduction - Python Meetup
Flask Introduction - Python MeetupFlask Introduction - Python Meetup
Flask Introduction - Python Meetup
 
Maven
MavenMaven
Maven
 
Php Conference Brazil - Phalcon Giant Killer
Php Conference Brazil - Phalcon Giant KillerPhp Conference Brazil - Phalcon Giant Killer
Php Conference Brazil - Phalcon Giant Killer
 
Creating a Plug-In Architecture
Creating a Plug-In ArchitectureCreating a Plug-In Architecture
Creating a Plug-In Architecture
 

Viewers also liked

CakePHP mistakes made
CakePHP mistakes madeCakePHP mistakes made
CakePHP mistakes mademarkstory
 
Recursive in CakePHP
Recursive in CakePHPRecursive in CakePHP
Recursive in CakePHPKetan Patel
 
Customize CakePHP bake
Customize CakePHP bakeCustomize CakePHP bake
Customize CakePHP bakeKazuyuki Aoki
 
Road to CakePHP 3.0
Road to CakePHP 3.0Road to CakePHP 3.0
Road to CakePHP 3.0markstory
 
CakePHP Community Keynote 2014
CakePHP Community Keynote 2014CakePHP Community Keynote 2014
CakePHP Community Keynote 2014James Watts
 
9 Awesome cake php tutorials and resources
9 Awesome cake php tutorials and resources9 Awesome cake php tutorials and resources
9 Awesome cake php tutorials and resourcesiScripts
 
Top 10 judicial interview questions and answers
Top 10 judicial interview questions and answersTop 10 judicial interview questions and answers
Top 10 judicial interview questions and answersBrunoMars345
 
Criando e consumindo Web Services (REST) com o CakePHP
Criando e consumindo Web Services (REST) com o CakePHPCriando e consumindo Web Services (REST) com o CakePHP
Criando e consumindo Web Services (REST) com o CakePHP2km interativa!
 
Tutorial de cakePHP itst
Tutorial de cakePHP itstTutorial de cakePHP itst
Tutorial de cakePHP itstomicx
 
RESTful Web Development with CakePHP
RESTful Web Development with CakePHPRESTful Web Development with CakePHP
RESTful Web Development with CakePHPAndru Weir
 
Using RequireJS with CakePHP
Using RequireJS with CakePHPUsing RequireJS with CakePHP
Using RequireJS with CakePHPStephen Young
 
How to write effective meeting minutes
How to write effective meeting minutesHow to write effective meeting minutes
How to write effective meeting minutesThurein Naywinaung
 

Viewers also liked (19)

Agile database access with CakePHP 3
Agile database access with CakePHP 3Agile database access with CakePHP 3
Agile database access with CakePHP 3
 
CakePHP mistakes made
CakePHP mistakes madeCakePHP mistakes made
CakePHP mistakes made
 
Recursive in CakePHP
Recursive in CakePHPRecursive in CakePHP
Recursive in CakePHP
 
Customize CakePHP bake
Customize CakePHP bakeCustomize CakePHP bake
Customize CakePHP bake
 
Road to CakePHP 3.0
Road to CakePHP 3.0Road to CakePHP 3.0
Road to CakePHP 3.0
 
Advanced Querying with CakePHP 3
Advanced Querying with CakePHP 3Advanced Querying with CakePHP 3
Advanced Querying with CakePHP 3
 
CakePHP Community Keynote 2014
CakePHP Community Keynote 2014CakePHP Community Keynote 2014
CakePHP Community Keynote 2014
 
REST API with CakePHP
REST API with CakePHPREST API with CakePHP
REST API with CakePHP
 
Full-Stack CakePHP Deployment
Full-Stack CakePHP DeploymentFull-Stack CakePHP Deployment
Full-Stack CakePHP Deployment
 
9 Awesome cake php tutorials and resources
9 Awesome cake php tutorials and resources9 Awesome cake php tutorials and resources
9 Awesome cake php tutorials and resources
 
Top 10 judicial interview questions and answers
Top 10 judicial interview questions and answersTop 10 judicial interview questions and answers
Top 10 judicial interview questions and answers
 
Criando e consumindo Web Services (REST) com o CakePHP
Criando e consumindo Web Services (REST) com o CakePHPCriando e consumindo Web Services (REST) com o CakePHP
Criando e consumindo Web Services (REST) com o CakePHP
 
Tutorial de cakePHP itst
Tutorial de cakePHP itstTutorial de cakePHP itst
Tutorial de cakePHP itst
 
Cakephp 3
Cakephp 3 Cakephp 3
Cakephp 3
 
RESTful Web Development with CakePHP
RESTful Web Development with CakePHPRESTful Web Development with CakePHP
RESTful Web Development with CakePHP
 
CakePHP
CakePHPCakePHP
CakePHP
 
PPT - A slice of cake php
PPT - A slice of cake phpPPT - A slice of cake php
PPT - A slice of cake php
 
Using RequireJS with CakePHP
Using RequireJS with CakePHPUsing RequireJS with CakePHP
Using RequireJS with CakePHP
 
How to write effective meeting minutes
How to write effective meeting minutesHow to write effective meeting minutes
How to write effective meeting minutes
 

Similar to Top 50 CakePHP interview questions

Cakephp Interview Questions
Cakephp Interview QuestionsCakephp Interview Questions
Cakephp Interview QuestionsPankaj Chauhan
 
Rapid Development With CakePHP
Rapid Development With CakePHPRapid Development With CakePHP
Rapid Development With CakePHPEdureka!
 
Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...
Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...
Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...JPLoft Solutions
 
Building Restful Web App Rapidly in CakePHP
Building Restful Web App Rapidly in CakePHPBuilding Restful Web App Rapidly in CakePHP
Building Restful Web App Rapidly in CakePHPEdureka!
 
Top 100 PHP Interview Questions and Answers
Top 100 PHP Interview Questions and AnswersTop 100 PHP Interview Questions and Answers
Top 100 PHP Interview Questions and AnswersVineet Kumar Saini
 
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01Tekblink Jeeten
 
Simplifying RCP Update and Install
Simplifying RCP Update and InstallSimplifying RCP Update and Install
Simplifying RCP Update and Installsusanfmccourt
 
Zend_Layout & Zend_View Enhancements
Zend_Layout & Zend_View EnhancementsZend_Layout & Zend_View Enhancements
Zend_Layout & Zend_View EnhancementsRalph Schindler
 
PHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterPHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterKHALID C
 
Apex behind the scenes
Apex behind the scenesApex behind the scenes
Apex behind the scenesEnkitec
 
Intro to drupal_7_architecture
Intro to drupal_7_architectureIntro to drupal_7_architecture
Intro to drupal_7_architectureHai Vo Hoang
 
Benefits of cake_php_in_web_development
Benefits of cake_php_in_web_developmentBenefits of cake_php_in_web_development
Benefits of cake_php_in_web_developmentXicom Technologies
 
Introduction to Google App Engine with Python
Introduction to Google App Engine with PythonIntroduction to Google App Engine with Python
Introduction to Google App Engine with PythonBrian Lyttle
 

Similar to Top 50 CakePHP interview questions (20)

Cakephp Interview Questions
Cakephp Interview QuestionsCakephp Interview Questions
Cakephp Interview Questions
 
FLossEd-BK Tequila Framework3.2.1
FLossEd-BK Tequila Framework3.2.1FLossEd-BK Tequila Framework3.2.1
FLossEd-BK Tequila Framework3.2.1
 
Rapid Development With CakePHP
Rapid Development With CakePHPRapid Development With CakePHP
Rapid Development With CakePHP
 
Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...
Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...
Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...
 
Know about cake php framework with vertexplus
Know about  cake php framework with vertexplusKnow about  cake php framework with vertexplus
Know about cake php framework with vertexplus
 
Building Restful Web App Rapidly in CakePHP
Building Restful Web App Rapidly in CakePHPBuilding Restful Web App Rapidly in CakePHP
Building Restful Web App Rapidly in CakePHP
 
cakephp UDUYKTHA (1)
cakephp UDUYKTHA (1)cakephp UDUYKTHA (1)
cakephp UDUYKTHA (1)
 
Manual 5
Manual 5Manual 5
Manual 5
 
Top 100 PHP Interview Questions and Answers
Top 100 PHP Interview Questions and AnswersTop 100 PHP Interview Questions and Answers
Top 100 PHP Interview Questions and Answers
 
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01
 
Flyr PHP micro-framework
Flyr PHP micro-frameworkFlyr PHP micro-framework
Flyr PHP micro-framework
 
Simplifying RCP Update and Install
Simplifying RCP Update and InstallSimplifying RCP Update and Install
Simplifying RCP Update and Install
 
Zend_Layout & Zend_View Enhancements
Zend_Layout & Zend_View EnhancementsZend_Layout & Zend_View Enhancements
Zend_Layout & Zend_View Enhancements
 
PHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterPHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniter
 
Apex behind the scenes
Apex behind the scenesApex behind the scenes
Apex behind the scenes
 
Intro to drupal_7_architecture
Intro to drupal_7_architectureIntro to drupal_7_architecture
Intro to drupal_7_architecture
 
Benefits of cake_php_in_web_development
Benefits of cake_php_in_web_developmentBenefits of cake_php_in_web_development
Benefits of cake_php_in_web_development
 
sample1
sample1sample1
sample1
 
Introduction to Google App Engine with Python
Introduction to Google App Engine with PythonIntroduction to Google App Engine with Python
Introduction to Google App Engine with Python
 
CakePHP Development
CakePHP DevelopmentCakePHP Development
CakePHP Development
 

Recently uploaded

CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 

Recently uploaded (20)

TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 

Top 50 CakePHP interview questions

  • 1. Top 50 Interview Questions & Answers in CakePHP
  • 2. 2 Top 50 Interview Questions & Answers in CakePHP Question : 1 What is CakePHP?  CakePHP is a free, open-source, rapid development framework for PHP. It’s a foundational structure for programmers to create web applications. CakePHP goal is to enable developers to work in a structured and rapid manner–without loss of flexibility. CakePHP takes the monotony out of web development.
  • 3. 3 Top 50 Interview Questions & Answers in CakePHP Question : 2 When CakePHP was Developed?  CakePHP started at april 2005.When a Polish programmer Michal Tatarynowicz wrote a minimal version of a Rapid Application Framework in PHP, dubbing it Cake.Cake php version 1.0 released in May 2006. (source:http://en.wikipedia.org/wiki/CakePHP)
  • 4. 4 Top 50 Interview Questions & Answers in CakePHP Question : 3 What is the current stable version of CakePHP?  2.5.4 (Released on 2014-09-02) Question : 4 What is MVC in CakePHP?  Model view controller (MVC) is an architectural pattern used in software engineering. Model: Database functions exist in the model View: Design parts written here Controller: Business Logic goes here For Detail : MVC Architecture
  • 5. 5 Top 50 Interview Questions & Answers in CakePHP Question : 5 Server requirements for CakePHP.  An HTTP server (like Apache) with the following enabled: - Sessions - mod_rewrite  PHP 4.3.2 or greater. Yes, CakePHP works great in either PHP 4 or 5.  A database engine (right now, there is support for MySQL 4+, PostgreSQL and a wrapper for ADODB).
  • 6. 6 Top 50 Interview Questions & Answers in CakePHP Question : 6 How to Install CakePHP? Step1: Go to cakephp.org and download the latest version of cakephp. Step2: Cakephp comes in a .zip file,so unzip it. Step3: Extract the files in the localhost in the desired folder (for example:cakephp). Step4: Open the browser and run the URL localhost/cakephp Step5: Just Follow the instructions display on the page.
  • 7. 7 Top 50 Interview Questions & Answers in CakePHP Question : 7 What is the folder structure of CakePHP? cakephp/ app/ Config/ Console/ Controller/ Lib/ Locale/ Model/ Plugin/ Test/ tmp/ Vendor/ View/ webroot/ .htaccess index.php lib/ plugins/ vendors/ .htaccess/ index.php/ README.md/
  • 8. 8 Top 50 Interview Questions & Answers in CakePHP Question : 8 What is the name of CakePHP database configuration file name and its location?  Default file name is database.php.default. Its located at "/app/config/database.php.default". To connect with database it should be renamed to database.php Question : 9 What is the first file that gets loaded when you run a application using CakePHP? Can you change that file?  bootstrap.php yes it can be changed. Either through index.php , or through .htaccess
  • 9. 9 Top 50 Interview Questions & Answers in CakePHP Question : 10 What is the use of Security.salt and Security.cipherSeed in CakePHP? How to change its default value?  The Security.salt is used for generating hashes. We can change the default Security.salt value in /app/Config/core.php.  The Security.cipherseed is used for encrypt/decrypt strings. We can change the default Security.cipherSeed value by editing /app/Config/core.php.
  • 10. 10 Top 50 Interview Questions & Answers in CakePHP Question : 11 What are controllers?  A controller is used to manage the logic for a part of your application. Most commonly, controllers are used to manage the logic for a single model. Controllers can include any number of methods which are usually referred to as actions. Actions are controller methods used to display views. An action is a single method of a controller.
  • 11. 11 Top 50 Interview Questions & Answers in CakePHP Question : 12 What is default function for a controller?  index() function  function beforeFilter() Question : 13 Which function is executed before every action in the controller?
  • 12. 12 Top 50 Interview Questions & Answers in CakePHP Question : 14 Using CakePHP, what all are drawbacks?  It loads full application before it starts your task. Its not recommended for small projects because of its resource heavy structure.
  • 13. 13 Top 50 Interview Questions & Answers in CakePHP Question : 15 List some of the features in CakePHP.  Compatible with versions 4 and 5 of PHP  MVC architecture  Built-in validations  Caching  Scaffolding  Access Control Lists and Authentication.  CSRF protection via Security Component.
  • 14. 14 Top 50 Interview Questions & Answers in CakePHP Question : 16 What is the naming convention in CakePHP?  Table names are plural and lowercased  Model names are singular and CamelCased: ModelName, model filenames are singular: ModelName.php  Controller names are plural and CamelCased with *Controller* appended: ControllerNamesController, controller filenames are plural and *Controller* appended: ControllerNamesController.php
  • 15. 15 Top 50 Interview Questions & Answers in CakePHP Question : 17 What is Scaffolding in Cakephp?  Scaffolding is a technique that allows a developer to define and create a basic application that can create, retrieve, update and delete objects. Question : 18 How to add Scaffolding in your application? To add scaffolding to your application, just add the $scaffold variable in the controller, <?php class PostsController extends AppController { var $scaffold; } ?> Assuming you’ve created Post model class file (in /app/Model/post.php), you’re ready to go. Visit http://example.com/posts to see your new scaffold.
  • 16. 16 Top 50 Interview Questions & Answers in CakePHP Question : 19 What is a Component in CakePHP?  Components are packages of logic that are shared between controllers. They are useful when a common logic or code is required between different controllers. Question : 20 What are commonly used components of CakePHP?  Security  Sessions  Access control lists  Emails  Cookies  Authentication  Request handling  Scaffolding
  • 17. 17 Top 50 Interview Questions & Answers in CakePHP Question : 21 What is a Helper?  Helpers in CakePHP are associated with Presentation layers of application. Helpers mainly contain presentational logic which is availabel to share between many views, elements, or layouts. Question : 22 What are commonly used helpers of CakePHP?  FormHelper  HtmlHelper  JsHelper  CacheHelper  NumberHelper  Paginator  SessionHelper  RSS
  • 18. 18 Top 50 Interview Questions & Answers in CakePHP Question : 23 What is a Behavior?  Behaviors in CakePHP are associated with Models.  Behaviors are used to change the way models behaves and enforcing model to act as something else. Question : 24 What is the difference between Component, Helper and Behavior?  Component is a Controller extension,  Helpers are View extensions,  Behavior is a Model Extension.
  • 19. 19 Top 50 Interview Questions & Answers in CakePHP Question : 25 What is a Element?  Element in CakePHP are smaller and reusable bits of view code. Elements are usually rendered inside views. Question : 26 What is a layout?  Layout in CakePHP are used to display the views that contain presentational code. In simple,views are rendered inside a layout.
  • 20. 20 Top 50 Interview Questions & Answers in CakePHP Question : 27 How to set layout in the controller?  var $layout = ‘layout_name’; for a specific action, use below code in that action  $this->layout =”layout_name”; Question : 28 How to include helpers in controller ?  public $helpers = array(‘Form’, ‘Html’, ‘Js’, ‘Time’); for specific action, use below code in that action  $this->helper[] =”helper_name”;
  • 21. 21 Top 50 Interview Questions & Answers in CakePHP Question : 29 How to include components in controller ?  public $components = array(‘Emails’, ‘ImageUploader’, ‘Sms’); Question : 30 How to write, read and delete the Session in CakePHP?  $this->Session->write(‘Bird.Color’, ‘Black’);  $black = $this->Session->read(‘Bird.Color’);  $this->Session->delete(‘Bird’);
  • 22. 22 Top 50 Interview Questions & Answers in CakePHP Question : 31 What is the use of $this->set();  The set() method is used for creating a variable in the view file.Say for example if we write,  $this->set('posts',$posts); in controller fie, then the variable $posts will be available to use in the view template file for that action. Question : 32 What is the use of $this->set(compact());  Using $this->set(compact()) , we can pass multiple parameters to access into the view file. For example, $this->set(compact('posts','users','reports'));  Now all these variables will be available in respective view file.
  • 23. 23 Top 50 Interview Questions & Answers in CakePHP Question : 33 What are the advantages of each? Which would you use and why?  An advantage with first case $this->set('posts', $posts); is that it allows two different names for the view file and controller file. For example, you could write something like $this->set('postData', $posts); Now the variable name in the view file would be $postData.  The advantage with the second approach , $this->set(compact()); is easier to write, and useful especially when we are setting several variables to the view.No need to add separate line for each variable as we have with $this->set(); For example,  $this->set(compact('posts','users','reports'));
  • 24. 24 Top 50 Interview Questions & Answers in CakePHP Question : 34 Is it possible to have Multiple validation Rules per Field in CakePHP?  Yes its possible.
  • 25. 25 Top 50 Interview Questions & Answers in CakePHP Question : 35 What is wrong with the below validation rule? 'email' => array( 'rule' => array( 'rule' => 'notEmpty', 'message' => 'Please Enter Email address.' ), 'rule' => array( 'rule' => 'email', 'message' => 'Entered Email address is invalid.' ) )
  • 26. 26 Top 50 Interview Questions & Answers in CakePHP Answer:  The problem is the first rule notEmpty will never be called because email rule will overwrite it.While using multiple validation rules for the same field you must keep the rule key "unique". In this case if we want to use multiple rules then, we can simple change the rule key names like, 'email' => array( 'rule1' => array( 'rule' => 'notEmpty', 'message' => 'Please Enter Email address.' ), 'rule2' => array( 'rule' => 'email', 'message' => 'Entered Email address is invalid.' ) )
  • 27. 27 Top 50 Interview Questions & Answers in CakePHP Question : 36 What is the difference between required and notEmpty in CakePHP?  To understand this question read this post: difference between required and notEmpty Question : 37 How to Get current URL in CakePHP?  To get current url in CakePHP use, echo Router::url($this->here, true);  This will give full URL with hostname. If you want to get relative path instead of full URL, then use the following code: echo $this->here;  This will produce absolute URL excluding hostname i.e. /controller/abc/xyz/
  • 28. 28 Top 50 Interview Questions & Answers in CakePHP Question : 38 How can you make url’s search engine friendly while using CakePHP?  It's an automatic task that is done by CakePHP. Question : 39 Can you list some database related functions in CakePHP?  find, findAll , findAllBy , findBy , findNeighbours and query.
  • 29. 29 Top 50 Interview Questions & Answers in CakePHP Question : 40 Which methods are used to create and destroy model associations on the fly?  The bindModel() and unbindModel() Model methods are used to create and destroy model associations on the fly. Question : 41 What is the use of requestAction method?  The method requestAction is used to call a controller’s action from any location and returns data from the action.
  • 30. 30 Top 50 Interview Questions & Answers in CakePHP Question : 42 What is recursive in CakePHP?  To understand this topic follow this post : Recursive in CakePHP Question : 43 How can we use ajax in CakePHP?  By calling ajax helper and then using it in controller for rendering.
  • 31. 31 Top 50 Interview Questions & Answers in CakePHP Question : 44 What is habtm?  Has and belongs to many is a kind of associations that can be defined in models for retrieving associated data across different entities. Question : 45 How CakePHP URL looks in address bar?  http://example.com/controller/action/param1/param2/p aram3
  • 32. 32 Top 50 Interview Questions & Answers in CakePHP Question : 46 How can you include a javascript menu throughout the site. Give steps.  By adding the javascript files in webroot and call them in default views if needed everywhere or just in the related views. Question : 47 Why CakePHP have two vendor folder? what is the difference between two vendors folder available in CakePHP?  There will be two vendor folders available in CakePHP framework. one in ” app ” folder and one in root folder  The vendor folder in the app folder is used to place the third-party libraries which are application specific.  The vendor folder in the root folder is used to place the third-party libraries which are used for multiple applications.
  • 33. 33 Top 50 Interview Questions & Answers in CakePHP Question : 48 What is the default extension of view files in CakePHP? can we change it? if yes then how?  default extension of view files is '.ctp'.  yes we can change it by writing public $ext = '.yourext'; in AppController.If you want to change it for particular controller then add it into that controller only.You can also change it for the specific action of the controller by putting it in that action of controller. public $ext = '.yourext'; in AppController - you can change all the views extentions. public $ext = '.yourext'; in specific controller like, PostsController - you can change all the views extentions of PostsController. public $ext = '.yourext'; in specific controller action like, index() - you can change the view extention of index.ctp Note: You cannot specify multiple extensions, however it seems like there is a fall back to .ctp if no .php file is found.
  • 34. 34 Top 50 Interview Questions & Answers in CakePHP Question : 49 How can you set custom page title for the static page?  To set a custom page title, copy-paste following code anywhere in your static page (.ctp) file:  $this->set("title_for_layout", "My page title"); Question : 50 How to display the schema of the model?  If you want to display the schema of particular model then you just need to add the following single line of code.  For example we have “Posts” Controller. pr($this->Post->schema());
  • 35. 35 To learn more about CakePHP, start reading our CakePHP Tutorials Series. CakePHP Tutorials Series
  • 36. 36 PHP Dev Zone Published by : www.php-dev-zone.com @phpdzone