It’s an good debate topic. But While i worked on different projects with these frameworks and I’ve made a list difference between them –
Auth, ACL Component/Library-
CakePHP has very strong Auth component with Core.
In CodeIgniter – you have to create or find a suitable plugin.
Code Generation
CakePHP’s Bake console can create any of CakePHP’s basic ingredients: models, views and controllers, can create a fully functional application in just a few minutes.
Very badly, Codeigniter doesn’t has code generation from console, you’ve to find out a plugin.
ORM
CakePHP comes with ORM(Object Relational Mapping is a programming technique for converting data between incompatible type systems in databases and object-oriented programming languages) while in CodeIgniter, does not supports.
Scaffolding
CodeIgniter’s Scaffolding feature provides a fast and very convenient way to add, edit, or delete information in your database during development which is deprecated from version 1.6.0.
CakePHP scaffolding is a technique that allows a developer to define and create a basic application that can create, retrieve, update and delete objects. Scaffolding in CakePHP also allows developers to define how objects are related to each other, and to create and break those links.
Ajax
CakePHP comes with Ajax helper which can be used in various ways. i didn’t see this with CodeIgniter core.
PHP Version
Both runs on PHP4 and PHP5 but both doesn’t take any facility of PHP5 while runs on PHP5 Machine. CakePHP declared, their upcoming version 2.0 will runs only on PHP 5.2 which definitely take advantage of PHP5′s OOP and ohter killer features.
Simplicity
I believe CodeIgniter is simple and working with this, it’s so easy while in CakePHP coding process is quicker for expert but its hard to find out what’s going on For Newbie.
MVC
Both of them are MVC supported framework but in Codeigniter you can build your project without Model which may lead messy and unsecured code sometimes(if anybody place direct query without any filtering). Codeigniter Model supports Method Chaining(PHP5 only) feature that’s fantastic. Most important is Model association, which absent in Codeigniter! In CakePHP, query are very simple to get value from a table by any field with related data.
Console
Cakephp came with console features. You can generate code or upgrade db schema from your console. If you are working with a team remotely and you don’t allow other user to handle your db directly – you can use this feature.
CodeIgniter doesn’t has this feature.
Validation
In Codeigniter, validation is handled by a validation class. The validation class can also help automate some of the process of setting error messages for specific fields.
In CakePHP, validation rules are defined in Model, can be validate data before save or at saving.which is little bit diffcult the codeigniter.
View/Layout
CakePHP handles this fairly well by using a default layout, easy to implement header , footer, sidebar while CodeIgniter takes a very straightforward approach – something like buiding a application from scratch. CodeIgniter allows caching mechanism for your view which is pretty good.
File Uploading
I love CodeIgniter’s file uploading class by which it’s very easy to handle uploading files. CakePHP doesn’t has this.
Other Classes
Codeigniter has many classes such as ftp, compression, cart etc etc classes. You may need certain classes for your project which already in CodeIgniter and not with CakePHP but you may find out component most of the time.
Web Services
Both has web services in built in. CakePHP has REST while CodeIgniter has XML-RPC but both doesn’t has SOAP, you need to find out component/plugin.
Auto Calling Functions/Other Functions
In CakePHP, there are few functions which are automatically called every time you refresh/hit a page and executed if you defined them such as beforeSave, afterSave, beforeRender etc – I just love these. I found a function called requestAction in cakephp that calls a controller’s action from any location and returns data from the action, sometimes its very useful.
Helpers
I found CakePHP helpers(such as form helper, it highlight input field for validation error automatically) are powerful than CodeIgniter.
Learning Curve
The learning curve of CakePHP is slightly higher than CodeIgniter. As CakePHP is a shade of ruby on rails, so its easy to get rails or cakephp developer to get them accordingly.
Support
CakePHP has solid support, you will get your answer very shortly while in CodeIgniter, i am still waiting for a answer in CodeIgniter forum, strange!
Documentation
Both are well-documented so far.
CodeIgniter comes with many classes, less of them are frequently used but missed important classes such as auth, straight forward but no automagic feature, MVC but not strict. I missed these features while i was working on a project using CodeIgniter. You may or may not face few problems while learning CakePHP but once you learnt,
URL Rewriting,example of custom URL rewritting,Paypal sandbox, Select / Unselect all the checkboxes,open cake thtml or ctp file with dreaweaver,generate a paypal token,cakephp
Tuesday, November 30, 2010
Wednesday, October 27, 2010
cakephp interview questions
1. what is cakephp ?
Ans :- Cakephp is a rapid development framework for PHP that provides an extensible architecture for developing, maintaining, and deploying applications. it uses commonly known architectural design patterns like MVC,ORM within the convention over configuration paradigm, It also reduces development costs and helps developers write less code.
2. what is the directory structure when you download cakephp ?
Ans :-
* app/
o config/
o controllers/
o models/
o plugins/
o tmp/
o vendors/
o views/
o webroot/
* cake/
o config/
o docs/
o libs/
* vendors/
3. what is the first file that gets loaded when you run a application using cakephp.,
Ans :- bootstrap.php , yes it can be changed , either through index.php , or through htaccess
4. what is model,view,controller.
Ans :- Model–view–controller (MVC) is an architectural pattern used in software engineering. Successful use of the pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other. In MVC, the model represents the information (the data) of the application; the view corresponds to elements of the user interface such as text, checkbox items, and so forth; and the controller manages the communication of data and the business rules used to manipulate the data to and from the model.
5: what is the naming convention in cakephp
Ans :- table names are plural and lowercased,model names are singular and CamelCased: ModelName, model filenames are singular and underscored: model_name.php, controller names are plural and CamelCased with *Controller* appended: ControllerNamesController, controller filenames are plural and underscored with *controller* appended: controller_names_controller.php, associations should use the ModelName, and the order should match the order of the foreignKeys: var $belongsTo = ‘User’; , foreign keys should always be: table_name_in_singular_form_id: user_id (foreign key) → users (table) , many-to-many join tables should be named: alphabetically_first_table_plural_alphabetically_second_table_plural: tags_users , columns in many-to-many join tables should be named like other foreign keys: tag_id and user_id , columns named “created” and “modified” will automatically be populated correctly
6: what is a component,helper and why are they used, is there other way we can do same thing, what is better.
Ans:- A component is an independent piece of code written for specific task that can be used by calling in controllers (example : email component), helper is used for helping cakephp in rendering the data to be shown to user with views, these only adds to modularity in code otherwise same coding can be implemented in conrollers.
7: what is the first function that gets loaded from a controller.
Ans :- index
8: what is habtm.
Ans :- has and belongs to many is a kind of associations that can be defined in models for retrieving associated data across different entities.
9: can you list some database related functions in cakephp.
Ans :- find, findAll , findAllBy , findBy , findNeighbours , query
10: how can you include a javascript menu throughout the site. give steps.
Me : By adding the javascript files in webroot and call them in default views if needed everywhere or just in the related veiws.
Ans :- Cakephp is a rapid development framework for PHP that provides an extensible architecture for developing, maintaining, and deploying applications. it uses commonly known architectural design patterns like MVC,ORM within the convention over configuration paradigm, It also reduces development costs and helps developers write less code.
2. what is the directory structure when you download cakephp ?
Ans :-
* app/
o config/
o controllers/
o models/
o plugins/
o tmp/
o vendors/
o views/
o webroot/
* cake/
o config/
o docs/
o libs/
* vendors/
3. what is the first file that gets loaded when you run a application using cakephp.,
Ans :- bootstrap.php , yes it can be changed , either through index.php , or through htaccess
4. what is model,view,controller.
Ans :- Model–view–controller (MVC) is an architectural pattern used in software engineering. Successful use of the pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other. In MVC, the model represents the information (the data) of the application; the view corresponds to elements of the user interface such as text, checkbox items, and so forth; and the controller manages the communication of data and the business rules used to manipulate the data to and from the model.
5: what is the naming convention in cakephp
Ans :- table names are plural and lowercased,model names are singular and CamelCased: ModelName, model filenames are singular and underscored: model_name.php, controller names are plural and CamelCased with *Controller* appended: ControllerNamesController, controller filenames are plural and underscored with *controller* appended: controller_names_controller.php, associations should use the ModelName, and the order should match the order of the foreignKeys: var $belongsTo = ‘User’; , foreign keys should always be: table_name_in_singular_form_id: user_id (foreign key) → users (table) , many-to-many join tables should be named: alphabetically_first_table_plural_alphabetically_second_table_plural: tags_users , columns in many-to-many join tables should be named like other foreign keys: tag_id and user_id , columns named “created” and “modified” will automatically be populated correctly
6: what is a component,helper and why are they used, is there other way we can do same thing, what is better.
Ans:- A component is an independent piece of code written for specific task that can be used by calling in controllers (example : email component), helper is used for helping cakephp in rendering the data to be shown to user with views, these only adds to modularity in code otherwise same coding can be implemented in conrollers.
7: what is the first function that gets loaded from a controller.
Ans :- index
8: what is habtm.
Ans :- has and belongs to many is a kind of associations that can be defined in models for retrieving associated data across different entities.
9: can you list some database related functions in cakephp.
Ans :- find, findAll , findAllBy , findBy , findNeighbours , query
10: how can you include a javascript menu throughout the site. give steps.
Me : By adding the javascript files in webroot and call them in default views if needed everywhere or just in the related veiws.
Thursday, April 29, 2010
Secure your Website from Hackers
Stop the Hack and Secure Your Website in 5 Best Methods
1. Add a robot.txt. This is a special instruction you will give to search engines who may be visiting your webpages. You can instruct them to only index those files that are meant for users. You can also direct them to not index any that are only meant for webmasters. These may include files and images.
2. Check the permissions you may have set for your uploaded files. This is to prevent any hacker from getting access into your important and confidential files. You can confirm it by selecting CHMOD for your files located in the web hosting server. Otherwise, if you aren't sure, then you can simply verify it from your webmaster.
3. Take away old or unnecessary files. It’s normal for search engines to keep files from your website, especially if they are being indexed. However, if you remove them from the server, then no one can access them anymore. It will not be obtainable for hackers and spammers.
4. Secure your source code. There are hackers who are interested in getting your source code to either destroy it or to build a website clone. That’s why it is very important that you can protect it against such individuals. You can make use of scripts that will allow your source code to remain hidden to Internet users. Or you can simply make use of external CSS sheets as well as files for Javascript.
5. You should password protect the admin folder of any scripts you are using, this provides an extra layer of security and is highly recommended. You can do this in cPanel by clicking the Directory Protection link.
1. Add a robot.txt. This is a special instruction you will give to search engines who may be visiting your webpages. You can instruct them to only index those files that are meant for users. You can also direct them to not index any that are only meant for webmasters. These may include files and images.
2. Check the permissions you may have set for your uploaded files. This is to prevent any hacker from getting access into your important and confidential files. You can confirm it by selecting CHMOD for your files located in the web hosting server. Otherwise, if you aren't sure, then you can simply verify it from your webmaster.
3. Take away old or unnecessary files. It’s normal for search engines to keep files from your website, especially if they are being indexed. However, if you remove them from the server, then no one can access them anymore. It will not be obtainable for hackers and spammers.
4. Secure your source code. There are hackers who are interested in getting your source code to either destroy it or to build a website clone. That’s why it is very important that you can protect it against such individuals. You can make use of scripts that will allow your source code to remain hidden to Internet users. Or you can simply make use of external CSS sheets as well as files for Javascript.
5. You should password protect the admin folder of any scripts you are using, this provides an extra layer of security and is highly recommended. You can do this in cPanel by clicking the Directory Protection link.
Wednesday, April 28, 2010
Tuesday, January 5, 2010
301 non-www to www or Permanent Redirect any single file URL to give some other one
Permanent Redirect your URL from non-www to www by using following code
RewriteEngine On
RewriteCond %{HTTP_HOST} ^websitedesigning-company.com [NC]
RewriteRule ^(.*)$ http://websitedesigning-company.com/$1 [L,R=301]
or
Permanent Redirect any single file URL to give some other one
RewriteCond %{HTTP_HOST} ^websitedesigning-company.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.websitedesigning-company.com$
RewriteRule ^mtp\/career_profile\.php$ "http\:\/\/websitedesigning\-company\.com\/mtp\/career\-advice\-online" [R=301,L]
OR
RewriteRule oldfile name$ new file name with full path
RewriteRule ^career-advice/interview-coaching$ http://www.mytalentplace.co.uk/interview-skills/interview-coaching [R=301,L]
for every . and /
we have to use \. or \/
RewriteEngine On
RewriteCond %{HTTP_HOST} ^websitedesigning-company.com [NC]
RewriteRule ^(.*)$ http://websitedesigning-company.com/$1 [L,R=301]
or
Permanent Redirect any single file URL to give some other one
RewriteCond %{HTTP_HOST} ^websitedesigning-company.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.websitedesigning-company.com$
RewriteRule ^mtp\/career_profile\.php$ "http\:\/\/websitedesigning\-company\.com\/mtp\/career\-advice\-online" [R=301,L]
OR
RewriteRule oldfile name$ new file name with full path
RewriteRule ^career-advice/interview-coaching$ http://www.mytalentplace.co.uk/interview-skills/interview-coaching [R=301,L]
for every . and /
we have to use \. or \/
Subscribe to:
Posts (Atom)