PHP commonly used code snippets

If you have max code execution limit error you can try resolve with following code  ini_set("max_execution_time", "1800");  ini_set('memory_limit','1048M'); if you want to display all hidden php errors  ini_set('display_errors', 1);

How to add layered tabbed content in togglebar

In order to present a lot of information to user in concise manner using togglebar is second to none which gives user the flexibility to switch content between visibility and invisibility. If you have been following the first toggle bar which you can check on this link, this post is modified and extended on that by adding two layered tabbed content inside that sidebar togglebar. For the illustrati...

How you can use jQuery fancybox to make gallary pop up

In your site, it is always wonderful to give user option to see list of images or videos with popup particularly on product review section in a web page. For this purpose, there is a nice jQuery plugin named fancyboxapp with which I am going to show you how to use that in the following. I also give you a demo link to view the full source code in action. Step 1 Html: In your html, it need...

Jquery left right sliding from sidebar

To hide large chunk of data on a page in web application, sometimes it is required to give user sliding option with a toggle bar from left or right side of page. In the following approach I will show you how you can make this sidebar toggle bar. Step 1 Html: For this togglebar you are going to need to sets of html one inside another like following         &l...

PHP larger random value generation

When customizing image names or file names during uploads, it is necessary to generate larger unique names. It can be done with following php function.  function generateRandomString($len = 80){  $base = 'abcdefghjkmnpqrstwxyz123456789';  $max = strlen($base)-1;  $string = '';  while(strlen($string)&nbsp...

Code runner - a super php debugger in VS code editor

To understand better php coding by debugging it is second to none to have code runner installed as extension in your own VS code editor. In your editor from the extension sidebar when you type code runner, there will be some listing coming named with code runner. But you need to click on the one which has 6.9M+ downloads. After download is completed now you have the super power of debugg...

Mysql updating field of main table from temporary table

Sometimes you will be needing to update the same field in the same table. However, in this case Mysql does not allow to reference the same table in both outer and inner select queries. So, came up with following stepsStep 1: Creating a temporary table which will be deleted later with those rows from main table.CREATE TABLE IF NOT EXISTS tbl_temp SELECT * FROM tbl_main WHERE field_id = 53Step: 2Ref...

Changing old domain to new domain in google analytics

Like redirecting urls, it is also important to change domain name in google analytics in order to get proper updated google analytics data.  It can be done in following steps which is really easy.  Log into GA -> Click admin from bottom corner -> click property settings from the middle -> change property name and default url field with new domain name and url.

How to redirect any old domain link to exact new domain link with htaccess

It is important to redirect to new domain link after migrating from old domain. More importantly, any old domain links needs to be redirected to new domain link after the migration. The way to do it is to take the help of htaccess file. So, create a new htaccess file in the document root of the old domain and drop this following code there.  Without www:RewriteEngine On RewriteCond %{HTTP_...

Using Aws s3 api with php for image uploading

Aws s3 is handy tool for storing and managing large image base for work. Following is the code skeleton for this purpose. require $_SERVER['DOCUMENT_ROOT'].'/assets/s3-upload/vendor/autoload.php'; // s3 image upload /////////////////// if(!empty($_FILES)){ $s3 = new Aws\S3\S3Client([ 'region' => $this->config->item('s3_region'), 'version' => 'latest', 'credentials...