Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

Find method with JOIN in CakePHP

Hello, if you are working on cakephp and you need the joins with find method here is an example. Here $my_joins is and array having multiple join cases in other different arrays inside it. $my_joins=array( 'joins' =&g...

How to Add a prefix to every URL in CakePHP?

Hello Reader! If you looking to fix a default language prefix for your all url in cakePhp then you can follow the steps which is the easiest and clean way :- Open file routes.php from the location Config/routes.php There in first line wri...

How to Install DebugKit on CakePHP

Hello Nerds! If you are going to develop a new project in cakephp then you might need Debugkit for that, and its really a lifesaving tool for rapid developments. You can install DebugKit using doing the following steps as:- Step 1:- You ne...

Functions and Arrays in PHP - Tutorial 5

This tutorial explains User Defined functions in PHP. It also explains Array, there types and how to iterate through arrays.

CakePHP 2.0 with Twitter Bootstrap

Hello nerds, If you want to start your new CakePHP project with Twitter Bootstrap set with it, you can follow the steps as following:- Step 1: You need to Download CakePHP and Twitter Bootstrap versions. You can easily download them from ...

How Cake PHP redirect with parameters in url

Hello readers, If you are using cakephp and want to redirect user to any other page/controller with some passing values in url, Well cakephp provides you its own syntax written in php, check bellow example: $this->redirect( arra...

How to create global variables in CakePHP?

The majority of the developers, develop skepticism in which, what's the correct place/Page in which they should declare the constant variable in cakephp. Previous going to variable declaration, we must consider that any of us will work over a ...

Why I switched from CakePHP to Symfony2

CakePHP or Symphony2? This is a common question that are arising in the developers community and topic lists this may lead developers sometimes get undermine to clarify users as which is the best framework in php. Lets talk about Symphony2...

base_url in CakePHP

Hello if you want current base url(Include Domain) or Get current url. Lets take an example http:// localhost/root_folder. you just need to write the following code below:- <?php echo $this->Html->url('/', true)?>

How to disable caching completely in Cakephp?

Hello if you want to disable you website's caching complety you just need to write configure code in core.php file ex You will have to look into /app/config/core.php and look for the line Open app/config/core.php file and try to find Con...

Submitting current timestamp in CakePHP

Hi If you want to send curret_timestamp, you can store it by using function below. DboSource::expression('NOW()'); Lets take an example, save your timestamp in a key 'your_datetime_field' $this->data['SomeModel']['your_datetime_f...

How to use another model in current model using cakephp?

Hi If you want a condition where you can load another model inside you model. you can do as I code, see the example below App::import('Model', 'MyModel'); $my_model = new MyModel(); Or you can write $this->SomeModel->MyModel;...

cakephp excel/csv export component

Hello, If you want to add CSV export component using cake php, for that you can do by following steps:- First take the controller file and create an action, the code will go like this:- <?php class Export_my_dataController extend...

What is the equivalent to getLastInsertId() in Cakephp?

Hello if you want to get last insert id or something equivalent to this you can try following steps:- Lets take this example, Here I just inserted the field in column $data = array('menuName' =$_REQUEST['menuname']) $this->Menu...

What is a .ctp file used for in CakePHP?

CakePHP provides user to do advance view designing and making custom architecture for designing, for quick web developments. The CTP file extension is associated with the CakePHP. Ctp file contains template CakePHP template. It is as same as a...

How to get complete current URL using Cakephp Framework in PHP

If you need to print the complete current url you can do following steps. 1. In the view file code will go like this: <?php echo $this->here; ?> This syntax'll give you the absolute url starting from hostname i.e. /controller/...

Facebook login using CakePHP

To create a Facebook login using cakephp we need facebook app with appId, apiKey and secret key which are required for facebook login to work. Facebook connect and enables users to authenticate your application instantly with a Facebook Account. ...

PHP functions for applying user defined functions on array values.

There are two predefined functions in PHP for applying user defined function on each element of an array. 1. array_walk() : array_walk() applied a user function on each element of an array. It returns TRUE on success and FALSE on failure. The...

Submit form data in Ajax

We will learn here, how we can submit form data with the help of Ajax. First step:- Create index.html file and create a form with the three labels/fields:- Name,Email and Superhero Alias. Inside head tag we have included one css file and ...

How can we find the number of days between given two dates on php 5.3 and above

Hi if you are using php version 5.3 or greater then some functions are really very quick to write and use. In this blog I am calculating the days between your given two dates. This is by far the most accurate way of calculating the differenc...

Exceptions Handling in PHP

PHP 5 comes with an exception model similar to that of other coding languages. Exceptions are essential and supplies a better management around problem managing. Try - Operate utilizing an exception to this rule ought to be within a "try" obst...

Insert and Remove value from end of an array

This article demonstrate how to add and remove value on start and end of an array using predefined functions of PHP. The four important array functions in PHP are : 1. array_push() : This function is used to add one or more values to the end o...

Create a Log File in PHP

Log file is very helpful in debugging a large amount of data. We can create a Log file with the piece of code below :- $file = fopen ( "testfile.txt" , "a+" ); fwrite ( $file , serialize ( print_r ( $_POST , true ) ) ); fopen() is php in...

What is php.ini ?

The php.ini file also known as (configuration file) is where we declare changes for Php settings. If you want to use the default settings then you can use existing php.ini file for the server else change settings by editing the existing php.ini ...

Creating a custom password encrypt for Auth in laravel 5.0

Many times when we have an existing database with existing multiple records with set password, encrypted with a specific encrypt technique and then we try to immigrate to Laravel 5.0 and try to use Laravel Auth, it clashes. Since, Lara...

Use of Transaction in Mysql

Transaction is very useful in large rich applications such as eCommerce, Real Estate etc etc. It is mostly used in Customer Relationship Management (CRM), Enterprise Resource Plan (ERP). What is Transaction? When we need to execute more than ...

How to store constants in laravel 5.0

In laravel 5.0 the way to define constants and use them through out the project. Following are the steps to accomplish it:- Step 1st :- Creating a separate file under /config folder named as constants.php ( it can be any name) for storing all ...

Datatypes in PHP and String Functions - Tutorial 3

Datatypes supported by PHP String Integer Floating point Boolean Array Object NULL Resource String Functions Strlen() : Returns the length of a string (number of characters). <?php echo strlen("Hello world!"); // output...

How to Fill Dropdown using jquery without using Ajax

Step 1=> Get all the countries data in an array and all states data corresponding to country wise. <?php $countries_Array = array( 'IN' => 'INDIA', 'BG' => 'Belgium', 'AU' => 'Australia', ...

How to fix TCPDF file opening issue on smart devices

Hello Friends, If you are using TCPDF( A Plugin used to generate PDf files) then sometime you may face that this files are not opening in smart devices. You may see some garbage data instead of pdf file. Then do not worry, just put a exit; af...

Convert array to string in php

We can convert array to string using php predefined function named as implode(). Syntax for implode is: implode('separator',array); Example - $split_data [0] = 'This'; $split_data [1] = 'is'; $split_data [2] = 'a'; $split_data...

Convert a string to array in php

We can convert string to array using php predefined function named as explode(). Syntax for explode is: explode('separator',string); Example - $string = "This is a text"; $split_data = explode('',$string); // splitting by space as a...

Google Map Integration in PHP- Display Latitude and Longitude On Google Map

This code will point the Latitude and Longitude On Google Map with a marker. For this include a script: Here is the code hope it may help you somewhere <html> <head> <script type="text/javascript"...

How to rename php file

After discussing about open, read and copying PHP files we will be discussing about rename function. rename (): The rename() function is used for renaming a file or directory.It takes two parameters : 1.the original filename 2.the new...

Google Map integration in PHP to Calculate Latitude and Longitude

This code will calculate the latitude and longitude of the place in background on entering the place name. For integration of Google map to calculate Latitude and Longitude major script is : <script src="https://maps.googleapis.com/maps/...

Visibility Scope Of Variable And Functions

There are three type of visibility scope: Public Private Protected PUBLIC: Variable or function of public scope can be accessed throughout the program. PRIVATE : Variable or function of private scope can be accessed only with...

Add prefix to urls in CakePHP

CakePHP has power to do a lot with conventions by using routes. Its additionally possible to utilize custom prefixes adjacent to your admin routes for extra flexibility. Prefix routing can be enabled from within the core configuration file by set...

PHP filters to Sanitize and Validate data

Hello Readers , Today we will going to understand the concept of PHP filters to Sanitize and Validate data. PHP filters are used to validate and sanitize external input. Validating data = Determine if the data is in proper form. Sanit...

Using database session handling in Code PHP

PHP is one of the scripting language. In which session handling is one of the key thing mostly using in web application. Suppose you build a website and allow to login everyone in website, You need to track user every step until they log out o...

Inheritance in PHP

Hello Readers , Here's the explanation of concept of Inheritance in PHP. What is inheritance? Inheritance is nothing but a design principle in oop. By implementing inheritance we can inherit(or get) all properties and methods of one cla...

PHP Copy Files

How to open and read PHP files have been discussed in previous blog: http://findnerd.com/list/view/How-to-open-and-read-files-with-PHP/3157/ Now,we will discuss about copying a php file. In php,we can Copy files from source to destination...

How to upload two separate files in php

Hi if you want to upload two separate files from one single form to be uploaded and with a for simplest code Look at mine code. The form will have two separate input files but you need to name them common, ex 'files[]' I'm using 'upload[]' in ...

How to compare PHP Variables and Arrays with null or empty values

Sometimes it is a bit confusing for developer to select right compare statement to check variables or arrays as there are lots of compare functions like "isset()", "!" operator, "is_null()", "empty()" etc. So we can use a straight forward appr...

How to open and read files with PHP

Before reading information from any file,we have to open the file for reading. This Blog will help you to find the code to read-open-close the file(s) on server we have created with PHP. Opening a file:fopen() This function enables t...

Diffrence between unlink() and unset() in php

When we will use unlink() then this function will delete to file test.jpg from given path. PHP <?php unlink("image/test.jpg"); ?> When we will use unset() then this function will remove content initialized with the PHP variable...

How to resolve 'Creating default object from empty value' warning in CodeIgniter

Coder missed a very simple fix and general good practice that you should always initialize your object before you try to set a property. It is very simple fix for this is simply to add a new StdClass; call right before the error with the variable...

Diffrence between echo and print in PHP

Hello Readers! You might have heard these "echo" and "print" statement in PHP many times. So here we will understand now what is the exact difference of these two words. Both echo and print are used to output a statement. Below are the some...

Difference Between $a and $$a in PHP

$$a uses the value of the variable whose name is the value of $a. It means $$a is known as reference variable where as $a is normal variable. It allows you to have a variable of variable This program can create the variable name the same way i...

What is the difference between == and === in php

When comparing values in PHP for equality we can use either the == operator or the === operator. The == operator just checks to see if the left and right both values are equal. But, the === operator actually checks to see if the left and right va...
1 12 14
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: