Featured
-
How Regression Testing Detects Integral Errors In Business Processes
Humans are forever changing and evolving and so to
by kristina.rigina -
Get Display Banner Advertising Opportunity on FindNerd Platform
“Do you have a product or service that nee
by manoj.rawat -
Android O Released with Top 7 New Features for App Developers
Android was founded by Andy Rubin, Rich Miner, Nic
by sudhanshu.tripathi -
Top 5 Features That Make Laravel the Best PHP Framework for Development
Laravel is a free open source Web Framework of PHP
by abhishek.tiwari.458 -
Objective C or Swift - Which Technology to Learn for iOS Development?
Swift programming language is completely based on
by siddharth.sindhi
Tags
Problem with password encryption when moving from core php to cakePHP
Hi all,
I had a requirement to move a project from core php to cakePHP framework. Migrating code was clear as I had to just modify syntax of code-base. But the problem came, when I had to implement login authentication with username and passwo...
Clean ugly HTML
CakePHP do help us a lot with its own 'Form' and 'HTML' helpers but it often outputs some very ugly and hard to read HTML.
This little trick will make it a lot cleaner.
Create a file named app_helper.php in your app's root directory.
Ne...
Solution for error 'The requested address '/' was not found on this server' in cake PHP
If anyone face the error 'The requested address '/' was not found on this server' in cakePHP, then try these two steps:-
Add function date_default_timezone_set() somewhere in you cake/app folder.
If above solution not works then place date_...
Stop browser to cache image ,css, js in cakePHP
core.php (inside /app/config/) has lot of features that help us improve our web application.
Configure::write(Asset.timestamp, force);
Setting the Asset.timestamp to force will add a time value after every css,js and image tag in your HTM...
Unbinding Model in cakePHP
Lets say there are two models named as User and Post. A User hasMany Post, so in our User model we have a relation like this :-
class User extends AppModel{
var $name = User;
var $hasMany = array(Post=>array(foreignKey=>user_...
Using Email or Username to login with auth in cakephp
We seldom need to login into application using Email or Username while using Auth with Cakephp. To achieve this we either need to write customized Auth component or we can achieve the same with the following code :
public function validateUs...
Forming Tree structure in cakephp
Sometime you may need to form a tree structure from the values of the database table.
For Ex-
You may need to form a hierarchy of categories and subcategories like this:
My Categories
Fun
Sport
Surfing
...
How to filter hasMany related model records in cakePHP when using find function?
Lets say we have models User and Friend related by User hasMany Friend relation. If we are required to pull out all users along with their female friends then how do we do that?
Usually people think like this :
$this->User->find('all...
Set column name for auth component of users table
When we use Auth component for login in cake php then we are restricted to use 2 column in users table 'password' and 'username' .If we want to use our own column name then follow these steps: Step 1: Include the below function in YoursController...
Remove wrapper from HTML element in cakePHP
In cakePHP, if you are using default render elements of cakePHP, then wrappers are automatically add. For removing wrappers from HTML element use the following syntax:-
Form->input('email_address', array(
'div'=>false, 'labe...
Cakephp - Using Config.php
We can use config.php in cakephp to define constant which need to be used in our whole project example we have different role id for different users.We can define those user corresponding to their role id and can easily access them through out ...
Naming convention in cakephp
Naming convention in cakephp
To get Maximum advantages from Cakephp then we need to follow some basic naming convention that cakephp rules says.
Naming convention follows principles of following section of cakephp
Database name
Contr...
Delete files from folder in cakephp 2.X
If anyone wants to delete file from the folder can use this code.
App::uses('File', 'Utility');
$file = new File(WWW_ROOT .'subcategory/thumbs/abc.jpg', false, 0777);
if($file->delete()) {
echo "File Deleted";
}
How use auth login in different model in cakephp
How use auth login in different model in cakephp
public $components = array('Session', 'Cookie',
'Auth' => array(
'authenticate' => array('Form' => array( 'userModel' => 'Admin',
'fields' ...
Internationalization of cakephp site
Internationalization of cakephp site:
STEP 1) Write the following code in cakePhp routes.php file
Router::connect('/:language/:controller/:action/*',
array(),
array('language' => '[a-z]{3}'));
...
Cakephp - Using multiple database
Many a times we need use multiple database as per the domain or some other reason . We can easily achieve it with the following code in cakePhp.
Write the following code in app->config->database.php
class DATABASE_CONFIG {
publ...
Cakephp - Using Auth
We can use Auth component in cakephp for authentication and authorization objects. Since it easy and secure way to do this.
Write following in your App controller
public $components = array(
'Auth' => array('loginAction...
Simple Cakephp Pagination
Cakephp provides a quick an easy way to paginate data.
In the controller we start by creating the pagination condition as given below :
public $paginate = array(
'limit' => 10,
'order' => array(
...
Cakephp - Removing setFlash bar
We can get rid of the flash message shown on a webpage in cakephp using setFlash method without refreshing the page by the help of simple Jquery function.
flashMessage is the default html id used by the cakephp while showing flash message.
...