Everyone want to write php code in wordpress as his mine. But wordpress support only its won code definitions. I wan to coded php in wordpress cms as like this code in a post and it should be work. but how......
[php]
<?php
echo "The year is: ";
echo date('Y');
?>
[/php]
There is a solution and I am giving you a plugin that you can write your php code as your mine.
For this you should follows the instructions-
Friday, April 20, 2012
Monday, February 27, 2012
Import CVS , Excel or XML file into MySQL with php
When we want to insert data into MYSQL which is already present in .CVS (comma separated values) or XML or Excel files. Reading the file row by row (say in PHP) and inserting into MYSQL is very poor style of coding which is inefficient and takes a lot of time. MYSQL has an inbuilt query and I will be elaborating about this.
Convert xml to cvs by php
I have used php 5.0 to convert xmx to cvs. Here "SimpleXML" reads an entire xml into an object that we can iterate through his properties.To write to the csv output file we will use "fputcsv". "fputcsv" formats a line as csv and writes it to the file.
Code of xml file (as the name "cars.xml") is here:
Code of xml file (as the name "cars.xml") is here:
Create favicon (*.ico) with imagick in php
Here is an example that will take any image format supported by Image Magick (is there one that is not?) and create a 16 pixel favicon image from it. The cropThumbnailImage() method does the work of resizing and cropping in a single swoop while the setFormat() method converts the file to .ico format.
Code is here:
Code is here:
Multiple file upload
Uploading multiple files with PHP requires checking for many possible errors. This script allows the setting of how many upload fields will be displayed in the HTML form and the maximum allowable filesize to upload. The php.ini file also contains an ini option named upload_max_filesize which has a default value of 2M, or two megabytes. This value is taken into consideration also when checking for errors.
The errors are stored in an array called messages and for each file upload a message is generated based on any errors or success of the upload. The form itself was validated with the w3c validator in accordance with the DOCTYPE.
Code with details is:
The errors are stored in an array called messages and for each file upload a message is generated based on any errors or success of the upload. The form itself was validated with the w3c validator in accordance with the DOCTYPE.
Code with details is:
Calculates the age in php
This simple function calculates the age, in years, of a date supplied in any format supported by the strtotime() funcition, which means, basically, any date you can sanely imagine.
Code of function is:
Code of function is:
Twenty Four Hour to Twelve Hour
Recently I have created robotic mailing system for my client. But when it needed to convert a bunch of 24 hour times to 12 hours, the times were in different formats but I needed them in a format that was easily human readable. This function will convert a twenty four hour time to twelve hour time. Feel free to modify it to your own needs.
Code is here:
Code is here:
Subscribe to:
Posts (Atom)