Description : Cakephp 3.0 provides a way to display different front end view for different clients using Themes. Theme is a plugin which follows the same structure as other cakephp plugins. Before Cakephp 3.0 it was only used to separate front end view for the clients. But in Cakephp Read more…
ACORD pdf forms are editable. We can not only fill data in existing input elements but also add more elements (like new buttons and fields) in the forms and invoke actions to submit data from pdf to an external URL.
In the example below we have an ACORD PDF in Read more…
Description : You have Fillable PDF on which you have button “Save Entered Data”. On button you want post the form data to php file.
Follow these steps :
1. Open Form with Adobe Acrobat Pro. Goto–>Tools.
2. From Tools, Go to Tools–>Rich Media.
3. Click on Select Object Read more…
Sometimes, HTML to PDF conversion does not show the same styling in PDF as it shows in HTML.
There are several reasons for that such as :
1. Bootstrap classes:
Using bootstrap classes in creating PDF could be the problem. A4 paper size has different width and height than our screen Read more…
Assume following is the path on your system in which you want to delete some files through code (unlink function):
Now if we use the same address in source variable (“C:\wamp\www”), it gives the following error:
unlink(): No such file or directory
This is because Read more…
Totara / moodle does not have the default feature to add custom HTML pages and display on the site. But we can achieve this by installing a plugin:
“General plugins (Local): Static Pages”
Steps to install and use this plugin in Totara:
1. Install the plugin like any other Read more…
Following UNION syntax works properly in CakePHP 2.4.6 version but it doesn’t work in CakePHP 2.5.2 version:
$unionQuery = $dbo->buildStatement
‘fields’ => array( required fields),
‘table’ => $dbo->fullTableName(database_table_name),
‘alias’ => ‘customObject1’,
‘limit’ => null,
‘offset’ => null,
‘joins Read more…
Introduction: We can make our Heroku app run different type of processes by creating a Procfile in the app.
There is a specific structure and syntax that we need to follow while creating a Procfile. Following are the main points to be considered while creating a Procfile:
The Procfile must Read more…
We can create new Zoho Subscriptions via code by using PHP curl and with the help of Subscription APIs.
Below is the sample code which is required to create a subscription:
$headerArray = array(“Content-Type: application/json;charset=UTF-8”,
“Authorization: Zoho-authtoken ——–Auth Read more…
In PHP if you want to replace multiple variables of the string at one go you could use strtr() instead of using str_replace().
$vars = array(
‘##reminders##’=> ‘ ‘,
$BODY=strtr Read more…
Description: By default, CakePHP authentication is applied to all application controllers. So it does not allow users to perform any of the action without login.
Solution: Each controller has a beforeFilter method which runs when some action is called from controller. Add below lines to your method:
Public function beforeFilter Read more…
The header function in the above code does not work. But when we remove the echo from the code, it works properly.
Code after removing echo :
header(“location:https://subscriptions Read more…
Using PHPGen Eclipse plug-in one can automatically generate getter /setter methods for instance variables.
Note: This Plugins is not available in Eclipse Marketplace.
Steps For Installation:
Start Eclipse and add “Help> Install New Software” from following URL: http://loge5.de/downloads/Eclipse/:
Click Add, enter http Read more…
How to use SimpleSAMLPhp as a Service Provider for authenticating users? Some Basic steps to start using simplesamlphp.
1. Download stable version of SimpleSAMLphp from this link:
2. Go to the directory or your workspace where you want to install simpleSAMLphp, extract the zip file. Give Read more…
￼Problem: How to separate redundant piece of code from your view using cakephp 3.0.
Description: Let’s take an example. You have a list of products to display. We show products at many places such as
1. Show all products.
2. Show products of the specific category.
3. Show Read more…
Description: In one of our PHP projects, we wanted to rename all the files in zip folder and then extract the zip.
The code for this is written below :
$zip = new ZipArchive;
$res = $zip->open($sourceFolder.’\’.$file);
for ($i = 0; $i < $zip->numFiles; $i++)
$filename = $zip->getNameIndex($i);
$arr Read more…
In Moodle we had declared some new strings in lang file of a plugin like this:
$string[‘LIBRARY_NAME’] = ‘E-Lab’;
$string[‘BOOK_READ_SUCCESS’]=’Congratulations on reading the book’;
We wanted to use it in view.php file of the plugin like this:
$result=Get_String(‘BOOK_READ_SUCCESS’, ‘plugin name’);
But the output was Read more…
Using PDFtk we can merge multiple files into a single file using a command like this:
Example : pdftk file1 file2 output file3.
Sample code to accomplish the same using PHP is given below:
$outputPDFName = “mergeResult.pdf”;
$multiplePDFs = $multiplePDFs Read more…
In one of our Moodle projects, we modified a plugin’s code to add extra functionality to plugin. The modification in plugin’s code was not reflected and Moodle showed the older version of plugin.
To solve this problem, we upgraded the Moodle database and changes in plugin’s code Read more…
Problem: Undo deleted file in Eclipse
Solution: We were working on a project in Eclipse. Accidentally one of the PHP files got deleted in which code was written. Eclipse does not use the Linux ‘Trash’ but keeps local history from where we were able to recover the file.
Follow these Read more…