Problem: How to insert csv data into mysql table with mysql query in php. What problems usually you face with this and how to resolve them.
Description: I have csv file with thousands of records. I want to insert these records in mysql table with php Read more…
Introduction: In Moodle/Totara we can add a different type of activities to a course by selecting from the list of standard activities available. As shown in the the list below:
But there might be some cases in which we need to add a custom activity to a Read more…
During testing, I had a test case to add multiple employees automatically with selenium script so I have implemented Data Driven Framework. Using this we have to read the data from the CSV and register all the users in the system.
Note: We need to add a jar Read more…
ADF XML FORMAT
ADF XML format stands for Auto-lead Data Format XML that is an automotive retailing industry standard data delivery format for import and export of automotive customer leads.
This format is used as a way to format the customer data so that the heterogeneous systems Read more…
In CakePHP application, core.php is configuration file and is located at app/Config/core.php. This file contains various variable definitions and constant definitions that alter the behavior of the application. The description of some important variables and their effect on the application is given below:
In my plugin code I was trying to redirect from one page to another page using redirect as follows:
Redirecting to the other page was working but during redirection an intermediate page was being displayed like this:
On click of continue button, it was redirecting Read more…
How to access Camera and upload the image/video to server?
We can achieve above requirements easily by using HTML Media Capture :
<form action=”upload.php” method=”post” enctype=”multipart/form-data”>
Capture Image: <input type=”file” name=”uploadedfile” accept=”image/*” capture=”camera”>
<input type Read more…
In moodle we can create scheduled tasks which will run after a defined interval. We also have cron jobs in moodle but they usually run after every minute so if we need to run a task after a particular time we need to create a scheduled task for this.
An Read more…
Some important settings that can help you while working with CakePHP 3 or 2.
1. How to set Homepage for your website in CakePHP 3?
Go to the root directory of your project. You will see config folder there. Inside Config
folder, open routes.php file. Add below the line Read more…
Problem: How to get list of all the Salesforce sobjects in php. Also get fields of each sobject.
Solution: First we need to install Salesforce php toolkit for this. Once you have it then this is the sample code:
require_once(SFDCPHPtoolkit / soapclient / SforcePartnerClient.php ‘);
$mySforceConnection = new Read more…
How to view List of constraints of tables of Database in phpMyAdmin
There are various ways by which we can view the list of constraints applied to tables of given database in PhpMyadmin. Let’s see few methods here:
Suppose we have a database named CollegeDb Read more…
Column 3 layout in Moodle is basically dividing the screen into 3 parts .
user setting options Layout (pre )
content layout (region)
editing layout (post)
user setting options Layout (pre): In column3 layout pre region is the first column. This column is at the left of the content. This Read more…
cipherSeed in CakePHP
cipherSeed is used in Security::cipher() function to seed rand(). Seed means to give the initial value to rand() function to start and based on that the future values by rand() function are generated. In php, before 4.2.0 version, Random Number Read more…
Heroku throwing ERROR: “The datasource configuration “default” was not found in database.php” with database configuration already present for cakephp app.
In one of our cakephp projects hosted on Heroku we used PostgreSql database. For configuring the database to connect to app code we renamed the database.php.default file Read more…
CakePHP Security Component is very useful and provides an easy way to enable very tight security in our application:
1. It can restrict which HTTP methods our application accepts.
2. It provides Form Tampering Protection.
3. It can force to require that SSL must be used.
4. It Read more…
In Totara how to add custom HTML elements (checkboxes, input boxes etc) and then access the value selected by user on server side:
1. Adding custom elements.
2. Accessing values of custom elements.
Each problem is discussed below: Overview:
In Totara, for blocks, we have some Read more…
In our Shopify store we have an order creation webhook that points to a cakephp action URL. The action that webhook points to fetches the order data and then saves this to the database.
The problem that we were facing with this webhook was that it was getting invoked multiple Read more…
In wordpress we can get title from post title and description from post content area dynamically:
$id = get_the_ID(); //get the post id.
$title = get_the_title($id); //get title from the post.
$content = get_post_field(‘post_content’, $id); // Get all content from post content area.
$trimmed_content = wp_trim_words( $content, 20, ‘….’ ); // This function trims Read more…
While fetching data from database, in SQL query I had ‘order by’ clause but the results were not sorted when the data was in alphanumeric form. The reason for this is that SQL sorts character by character from left to right. So it places c10 before c2 as 1< Read more…
Let us take an example:
We have table employees with following fields:
id int primary key,
We have following records in the table:
(1, isha, amr);
(2, Hamlet’s, ghy);
(3, éhjj, amr);
2nd and 3rd records have special characters in their Read more…