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

How to implement cron job using laravel 4.x

A cron job is time-based job scheduler in Unix-like computer operating systems. This is normally used to schedule a job that is executed periodically or in simple word we can say when we want to execute any command automatically after some time t...

What is the best way to create global variables in CakePHP?

Hello All, In this blog we will discuss creation of global variables in CakePhp. Sometimes there is a need to access a variable everytime in the application, so instead of declaring it again and again we can declare the variable globally ...

Add multiple simple type products to cart programmatically

Sometimes we need to add multiple simple type products to cart programmatically from listing page or using ajax. To do that we need to do some modification in listing page html so required data will be post using add button. Below is the funct...

How to speed up your CakePHP Website

Hello Readers, These are some techniques to speed up the cakephp website:- 1. Upgrade versions regularly When you work on cakephp website.You need to upgrade your Cake website to the latest version in order to keep it performing at its be...

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 ...

How to add the custom field in default joomla 3.x registration form

I am posting the steps below to add the custom field in default joomla 3.x registration form: 1.Navigate to joomla_root/components/com_users/models/forms/registration.xml and add a field there. 2.Then open up joomla_root/components/com_users/mo...

How to pass variables from CakePHP to JavaScript

Hello All, In this blog we will discuss about how to pass CakePhp variable in javascript. So firstly we will be initiallizing a variable in the function below i.e abc(),then set this variable in for the ctp file. Example- function abc...

How to get current web page url in Laravel 5

To get the current web page url in Laravel 5. you can use the URL::current() helper function. here is an example. Route::get('/current/url', function() { return URL::current(); });

How to enable & disable maintenance mode in laravel 5

There are two ways to enable & disable maintenance mode in laravel 5.Whenever your website is in maintenance mode, laravel return a custom view that will be displayed for all requests. This makes it easy to "disable" your website or applicati...

How to disable user registration in Laravel 5

Laravel 5 provides built-in user registration and login functionality which allow developer to easily integrate both functionality in their application. But some times laravel developer wants to disable the user registration or restrict user for ...

How to disable caching completely in Cakephp

To completely disable caching application wide, you will have to edit /app/config/core.php and change the line Configure::write(Cache.disable, true); This line is commented by default and you will have to remove comment to disable caching...

How to enable CakePHP's SQL dump in the controller

Hello All, In this blog we will discuss about how to enable the SQL dump in your CakePhp's controller. For this you have to write in below code in your controller function- $db=ConnectionManager::getDataSource('default'); $...

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...

How to set checkbox to checked in CakePhp

Hi All, In this blog we will discuss about how to set checkbox checked in cakePhp application. You should set the checkbox checked/selected with the 'selected' option. For example- You can find a list of categories from the database t...

Fat models with skinny controllers in cakephp

In fat model and skinny controllers method we write our database query in model. Normally we use validation rules and model binding in our model and all query write in controllers but as we know that when url routing requests first comes to contr...

How to change user password in CakePhp using Auth

Hi All, In this blog we will discuss how to change the password in cakePhp by using Auth. Firstly, in your model you have to define a function beforeSave which will hash your password to auth password, you can do this by writing the below co...

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...

Checking an Ajax request incakephp

For checking the ajax request one have to use the request handler component. In Cake PHP to obtain the information about the HTTP request as a form of AJAX which are requested into your application for that the Component Request Handler is use...

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;...

How to load Vendors in CakePhp

Loading vendors usually means you are loading packages , so in CakePHP you can use: App::import('Vendor',''); As an expample if you want to load a vendor named recurly which is saved in your app's Vendor folder and you want to access the...

Updating one field in database using CakePhp

Updation in CakePHP is basically based on knowing the primary key(Id) of the records one wants to change/edit. You can update a field in CakePhp by two ways:- a)By using saveField method $this->ModelName->id=$id; $this->Mode...

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. ...

How to write a join query across multiple tables in CakePHP?

Fetching data from the database takes a lot time process. Eventually when you need to combine multiple tables in order to fetch the data, reducing database calls becomes very meaningful. Although in CakePhp's model, by default if the associat...

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...

Urlencode & Urldecode in php

"Urlencode is a predefined encoding function in PHP". We use Urlencode to encode a string that we are using in a url string. Url encodes the same way as we posted the data from web pages. It returns the encoded string. Syntax:- urlenc...

PHP Basic Errors?

There are three basic types of errors in PHP: Notices: These errors are not displayed to the user at all , the default behavior can be changed. These are non-critical errors that encounters by php while executing a script - for example va...

What is MIME and MIME Type?

MIME stands for - Multi-purpose Internet Mail Extensions. MIME types represents a unique file types as pre-defined over Internet. Web servers and browsers have a list of MIME types, which make a medium for files transfer of the same t...

How to hide/display different actions in an Admin Panel for a project in cakephp

After we have learned how to create an Admin Panel for a project in cakephp see the link. Now in this tutorial we will learn how to enable/disable different actions such as add,view ,edit, delete, records in a table say posts or increase/decrease...

How to get address from latitude and longitude

If you would like to get address from latitude and longitude. You can use below function: public function getAddressbylatlong($latitude, $longitude){ $latlng = $latitude. ','.$longitude; $geocode = file_get_contents('http...

How to send Push notification on Android mobile

If you want to send push notification on Android mobile please use the below function: Requirement :: a) Mobile TokenId b) Google API Key public function send_notification_mobile($mobiletokens, $GOOGLE_APIKEY){ // API ac...

Show the product description below an image-Woocommerce

In WooCommerce site we need to provide product description underneath an image, so if you are stuck in this and looking for solution to show the product description below an image here is the solution. Add the code below to your functions.php:...

How to show stars instead of theme ratings in Woocommerce

If you want to show stars instead of theme ratings in Woocommerce, you can do this by changing the Woocommerce star ratings. The Stars rating is the default rating system in WooCommerce, so to match the rating system with themes we have to dis...

Mail function PHP

PHP provides us a predefined function named as mail() for sending mails. Syntax: mail(to,subject,message,headers,parameters); Ex:- $mail_msg = "This is my test mail"; mail("abc@gmail.com","My subject",$mail_msg); // Sent mail ...

Reverse a string php

We have predefined function name as strrev() to reverse a string in php. Syntax is:- strrev(string); Ex:- $data = "Good Book"; $reverse = strrev($data); echo $reverse; Output is:- kooB dooG

Count No. of words in a string php

User can count the number of words in a string using php predefined function name as str_word_count() Syntax is: str_word_count(string name); Ex:- $string = "This is new text"; $count = str_word_count($string); echo $count; ...

Password Hashing Method in WordPress

Hello reader's today we will discuss about "Password Hashing Method in WordPress". WordPress doesn't store password in plane text. If you lose your password you need to reset your password via email. WordPress stores its cryptographic salts...

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...

How to inherit a controller in another controllers in cakephp

Hi reader's today we will discuss "How to inherit a controller in another controllers in cakephp". In cake php controllers are nothing more than php classes, You can inherit a controller to another just like a hierarchy of inheritance. Let's h...

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...

How to call another controller function in a controller in cakephp

Hello reader's In this tutorial we will discuss about "How to call another controller function in a controller in cakephp". For doing this, first of all import controller function in your controller that function you want to call. Once you im...

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...

How self is different from $this in php.

Hello reader's lets discuss "How self is different from $this in php". Generally, we can claim that $this is used to reference the current object, whereas self is used to access the current class itself. yet there are many things and details a...
1 38 44
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: