Detect mobile device php code
We often need to detect if site visitor is using an iPad, a smartphone or any other mobile device in order to change website appearance and even make it faster by reducing data load. Normally we use the media queries and Read more…
How to resolve “Class ‘App\Controller\Aws\S3\S3Client’ not found” error in CakePHP 3.*
Problem: Class ‘App\Controller\Aws\S3\S3Client’ not found error occurs when we are trying to create S3Client class object with given code (code copied from github):
$s3 = new Read more…
How to sort query result according to various search conditions in fetch query of CakePHP 2.
Problem: Priority based sorting of records
Example: Search a string (“Proposalways StudySection”) and display records in following order:
Contain all words (“Proposalways StudySection”) in Read more…
Purpose of multiple .htaccess files in CakePHP
In Cakephp, contained .htaccess files are as follows:
CakePHP root directory .htaccess redirects everything to your CakePHP app (means to webroot). We can also redirect the url to some Read more…
Using Google Search Operators for Better Results
Google defines Search Operators as the “words or symbols in one’s search phrase that make the search results more precise”. These operators have their basis in coding as they are nothing but shortcuts in procuring the best results Read more…
How to use CakePHP Validation class
We can use CakePHP validation functions and speed up development. These functions already follow the correct rules so we don’t need to write custom code.
$validate = new Validation();
$string = ‘Name123’;
$result = $validate->alphaNumeric ( $string );
if ($result Read more…
What support/library is there in CakePHP for sending emails and how to use it?
In CakePHP3, there are Transport and Email classes available under Cake/Network/Email namespace that are used for sending emails. After an update in the version 3.1 email functionality has Read more…
How to use mpdf plugin in cakePHP to convert HTML documents to pdf?
mPDF is a PHP library which is used to generate PDF files from HTML Documents. It converts utf-8 encoded documents and also supports almost all languages including Arabic and Hebrew. It includes Read more…