Featured
-
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 -
Best 5 Lightweight PHP Frameworks for REST APIs Development
Are you ready to develop the Rest AP
by ankur.kumar -
PHP: Full-Stack Framework vs Micro Framework
A web framework can be described as a software fra
by ankit.bhatia -
How to get facebook profile picture by Facebook App
If you would like to get your profile picture in f
by vivek.rastogi -
Creating RESTful API in cakephp
This tutorial will help you to learn how to create
by pushpendra.rawat
Tags
How to use GROUP_CONCAT in a CONCAT in mysql
GROUP_CONCAT will always return a string value . It can be easily explain by the example.
Example:
bookid | bookname | isbnno | cateid | autid | pubid
| BK001 | Introduction to Electrodynamics | 0000979001 |...
How to fetch data from array using php ?
You can take reference form below example to fetch data from array list using php.
This method is really very easy.
<?php
// you have to Decode the array and store a variable
$GetRecord = json_decode('[{"Name":"Mac","age":"25"},{"Na...
How to apply CSS style in CakePHP ?
To apply a CSS Class to a form generated by the Form Helper in CakePHP see the example below
1. To add a class to a form tag:
echo $this->Form->create('User', array('class'=>'form'))
2. To add a class to a input tag:
echo ...
How to make custom logo in admin of Wordpress
Hello Reader's!
If you are new to wordpress and need to set your own logo from admin then you can use the wordpress custom logo management in the code:-
First create of open the file, Functions.php in the root directory.
now paste the code ...
problem in implementing Clean URLs, Drupal 7
if your drupal installation having problem in implementing Clean URLs then please check your Apache is configured as mentioned below
Apache uses httpd.conf file for its configuration.
In order for Drupal to implement clean URLs, Ap...
Logging and errors
Navigate to Logging and errors in the `DEVELOPMENT` section of the `Configuration`. This page provides a few options used to control how errors are displayed and logged
Under the ERROR MESSAGES TO DISPLAY you have three options
No...
Locked and logged out when on maitenance page, Drupal 7
All major development or changes to a site should be performed on the development machine and once thoroughly tested then only be implemented to the live site.
There are chances when you have to make changes on live site directly. In t...
Actions and triggers in Druppal 7
Many time it happen we want the Drupal to perform certain task or action automatically We use action in drupal to automate certain task mainly task which need to be acted upon content and user account. By default there are number of simple and ad...
Installation steps of zend framework2 on ubuntu
Welcome to Findnerd. There are simple steps to set up the zend2 on Ubuntu. We need to use the terminal for same. Please follow these steps.
A) LAMP should be installed on your system. Create a folder with any name in /var/www. We are givin...
Positions in Joomla
Joomla works on positions. Position works as a placeholder in Joomla Template where we place a module. According to those positions Joomla application able to place the module to a particular portion of a page. For example, the module position le...
What are the different array functions in sorting an array?
Hello Readers
Below is the Sorting functions in PHP:
sort(): It is an array function which is used to sorts the array and it will be arranged the elements in ascending order (lowest to highest).
Example of sort():
<?php
$su...
Discussion on zend2
Welcome to Findnerd. PHP owners modified the zend framework that is zend framework 2. We can simply download the framework setup from github that is known
as zend skeleton application. Below is the link to download.
https://github.com/zendfr...
How can we know the count/number of elements of an array?
Hello Readers
In php we count the number of elements of an array by two ways:
1. sizeof()
2. count()
sizeof()
sizeof() function is an alias of count() and it is used to count the elements of an array.
Syntax of the function siz...
How to add banners in Wordpress site header
Whether you are newbie web Developer or Tech Geek, WordPress is great CMS (Content Management System) platform experimenting to make a website with thousands of tweaking plugins for customization. For changing header or footer you need to install...
How to use WPDB in standalone script?
Hello readers, today we discuss about ""
Q. What is Standalone script?
Ans. Standalone is also consider a new software program, it does not involve almost any computer software in addition to this OS to operate. Consequently nearly all softwa...
Ajax call in wp-oauth plugin
Hello readers, today we discuss about "How to call Ajax in wp-oauth Plugin".
"wp_ajax_your_function_name" its a pre define method for loged in users.
You can put the below code into plugin.php file. "getMinorCatList" is a function where aja...
Static method in PHP
When we declare a function as static then we generally get confused about what to use like '->', '::', 'this' or 'self'.
There are something we need to take care of when declaring a function as static:
1: If the variable or method being...
Get Cookies from Php Curl into a variable?
Hello readres, today we discuss about "Get Cookies from Php Curl into a variable?".
CURL provides an option (CURLOPT_RETURNTRANSFER) to set a callback that will be called for each response header line. The function will receive the curl object...
How to check if cookie is enable or not
Hi. If you are looking for code to alert user if his cookies are enable or not, Then look the code as below:-
paste the code in you file
<?php
if (isset($_COOKIE['cookieCheck'])) {
echo 'Your cookie is Enable';
} else {
if ...
Order confirmation mail not sending in magento 1.9+ versions
From magento 1.9+ versions , emails are not being sent directly , they were queued and queued mails were being processed by magento cronjob. You need to set the cron job correctly to send the mail.
If you want to send mail forcefully after pla...
Update without touching timestamps (Laravel)
I want to update my data but I dont want to update my timestamps. Laravel 4.x provide us the facility to update our data without updating our timestamps.
The example to Update without touching timestamps using Laravel 4.x is:
$user = User::...
Laravel Creating Dynamic Routes to controllers from Mysql database
I want to create dynamic routes to controller from mysql database.We have the available following table for this.
id name route
--------------------
0 About about
1 Contact contact
2 Blog b...
An active access token must be used to query information about the current user
Hello Guys,
While working on FB APP you might encounter with this error "An active access token must be used to query information about the current user". I have faced the same problem and during R&D I got to know FB.init works async mode so...
How to concat two fields in cakephp
In simple sql query we concat two fields by using concat keyword
SELECT CONCAT( `firstname` , ' ', `lastname` ) AS fullname
FROM user
But in cakephp we can do this by using 'virtualFields'
class User extends AppModel {
publi...
How to configure database in CakePHP ?
Database configuration in cakePHP: Cake PHP configuration file is found in app/Config/database.php
Example of database configuration file in app/Config/database.php.default.
class DATABASE_CONFIG {
public $default = array(
'...
What is the difference between two vendors folder available in cakephp?
Hello Readers
In Cakephp framework (based on MVC) you noticed that there are two vendors folder.
1. One is it is in app folder.
2. Second one is in root folder.
Therefore, the use of two vendor folders in Cakephp is that first (whic...
Data Validation in Cake PHP
Data validation becomes an important part of any of the application. It helps to make it sure that the data input by the user is proper or not.
Defining the validation rules in any application makes the form handling easier. Validation differs ...
Cookie in php its uses and types
Hello Readers
A cookie is often used to identify a user. It is a small amount of information that sent by a server to a browser and after that sent back to the browser.
The below is the syntax of cookie:
Syntax:
setcookie(name, valu...
Create, Edit and Delete Crontab Jobs
Hello readers, today we will discuss about Crontab jobs.
Q. What is crontabs?
Ans- Cronjob is a service or we can say its a tool that run in backend periodically at fixed times, dates, or intervals.
The crontab is a list of commands that...
How can I sort one dimensional arrays and data in PHP?
Basic one dimensional arrays
$array = array(3, 5, 2, 8);
Applicable sort functions:
sort
rsort
asort
arsort
natsort
natcasesort
ksort
krsort
These all are the sorting method which will help us to sort an one dimensional array.
What is the difference between client-side and server-side programming?
There are n number of difference between client-side and server-side programming.
The below code is split into two entirely separate parts, the server side and the client side.
|
---------->
...
Where to find error logs in PHP
Hello Reader's!
If you need to access your error log files in php then using Linux you can browser it as follows:-
abhishek@roor /var $ sudo updatedb
[sudo] password for abhishek:
abhishek@roor /var $ sudo locate error_log
...
eloquent laravel: How to get a row count from a ->get()
count is method which will return an array.It is a query builder. So to count rows from using a ->get() is
The syntax to count a row a -> get() is
$wordCount = count($wordlist);
If you have a wordlist model, then you can use Elo...
How to make a quick login page in Wordpress
Hello Reader's!
If you are new to Wordpress and want to make a login custom page, then you can see an example below:-
First you have to create a page on the root, name it login.php
<?php
/*
* Template Name: Sign In
*/
if($_PO...
Component & Helper in Cakephp and why are they used?
Hello Readers
A component is an independent piece of code written for specific task in cakephp that can be used for Emails, RequestHandling etc.
Components is basically a package of logics that are shared between controllers. User also crea...
Features of cakephp
Hello Readers,
Below are some of the features of CakePhp:
CakePhp is basically a framework which is based on MVC pattern i.e(model view controller).
Cakephp is compatible with php version 4 and 5 plus.
Cakephp have built in validati...
How to use PHP inside the Javascript
Hello Reader's!. If you having the JS file and you need to do some php coding inside the file, Then you can use the following coding standard:-
<script type="text/javascript">
var jsVvariable = <?php echo json_encode($phpVariable); ?...
What to pass as parameters to the Url class?
There are n number of situation where we want to pass parameter in URL and use that parameter in our controller.That can be easily explain by using example:
There are few steps which I have implemented that are:
Step 1:First we will define...
Laravel 4 Eloquent Query Builder - Complicated joins with variable
As we all know joins play an important role in any project . So Laravel 4.x also provide Eloquent Query Builder in which we are able to use Complicated joins with variable.This can be easily explain by using example
Example:
I managed to fi...
laravel 4 artisan how to rollback to a specific migration state?
There are n number of command in laravel 4.x which can help us to perform any action . In laravel 4.x we can rollback our php artisan command. The command to rollback to a specific migration state is
You can:
1)Rollback The Last Migration ...
Change name of Laravel's created_at and updated_at
As we all know when we create table using php artisan and migration. Laravel create 2 column in the end of the database that column are created_at and updated_at .
We have a situation when we want to override these two names created_at and upd...
Send Email with an attachment in Drupal 7
If you are confused and trying to figure out how to just simply send a mail with and attachment using drupal_mail(), with a given $body and $subject, this below code may help you.
/*hook_mail($key, &$message, $params);*/
//for detail ...
Can I Install Laravel without using Composer?
I am unable to figure out as to how I can install or use the Laravel PHP framework on any webserver without relying on the need of using Composer (PHP package/dependency manager) every time.
I am making efforts to gain insight into PHP and fra...
How to get the current URL inside @if statement (blade) in Laravel 4?
In Laravel 4.x we have many predefined function which will help us to solve basic requirement. For getting the current URL inside @if statement (blade) in Laravel 4? are very easy.Syntax and Example for getting the current URL is:
Syntax: Th...
Laravel form model binding
Form Model Binding is one the important feature in Laravel 4.x. I am reading about this feature from the below link.
http://laravel.com/docs/html#form-model-binding
I have a situation where " The model (User) I want to bind in my form has a s...
How can I get the session ID in Laravel?
In some situation we need session id. In Laravel 3 and Laravel 4.x we have predefined function by which we can get session id. In laravel 3 we will get session id:
Laravel 3:
$session_id =_COOKIE["laravel_session"];
Laravel 4.x:
$s...
How do I create a RESTful API in Laravel to use in my BackboneJS app
We have a situation where we want to create a RESTful API in Laravel 4.x and we have to BackBoneJS in my project .By using below step we can make RESTful API easily using BackboneJS.
This is an example for creating an API that stores bookmarks...
How to set a default attribute value for a Laravel / Eloquent model?
Laravel 4.x provide n number of services to solve basic issues. By using Laravel 4.x we will easily set a default attribute for a Laravel/Eloquent model.
To achieve this we have to define value like below example:
Example:
protected $def...
Laravel Controller Subfolder routing
Before I have written blog how to add sub-folder in our controller but not mention that how we will do Controller sub-folder routing.As we all know that routing plays an important role in any project. In Laravel 4.x sub-folder routing can be don...
'Failed to open stream: Permission denied' error - Laravel
Some time in Laravel 4.x we will get the error "Failed to open stream: Permission denied" error .When we have no permission then this type of error will occur. So to overcome this problem by using php artisan
are:
Step:
php artisan cache:...