Archive for "PHP"
Feb08Converting a text string into comma separated words
Today, i was looking at some old code of mine to find something when i found this little but useful piece of code which i had written for one of my old projects (and of course when i didn’t had this blog created yet). The idea was to create comma separated words from a string, something like, creating meta keywords from a piece of information (such as meta description). Click to continue »
Dec09Setting up a catch-all email forwarder and parsing emails using php
In one of my ongoing projects i had to set up a “catch-all” email parsing script. Here’s how it came out to be.
What is catch-all?
In the context of emails, “catch-all” refers to a destination to which all incoming emails with in-correct email addresses are delivered or forwarded. As a destination, you can set either an email or a script on your server which captures such emails and save them in to your local database or files. Click to continue »
Sep29Form DOM element not recognized (created) in ajax form in IE when placed with end tag missing
Skipping a form end tag </form> costed me almost a day (i had to go to bed abandoning the fixing for some time though;)). I had been using ajaxForm with jQuery to submit ajax form which was placed on a popup dialog box opened through ajax. The form worked well in Mozilla Firefox, Google Chrome, Safari but did not work in Internet Explorer 7 & 8 (IE7 & IE8 ; i didn’t test in other versions of IE but perhaps they would not work either). The IE simply would not create the <form> tag at all so if you try to alert $(“#formID”).length it would return always 0(zero). It started to work fine (in IE) when i placed </form> to mark the end of the form (i know it was a mistake to not to place it there though). Click to continue »
May14A note on setting up execution memory and time limits for php scripts
When executing large amount of data through php scripts it is common facing errors like “Fatal error: Maximum execution time of 300 seconds exceeded..”. Also, sometimes uploading large files through php scripts you might face errors like “The uploaded file exceeds the upload_max_filesize directive in php.ini..” etc. etc.. Click to continue »
Apr16Better way to write php code – part 2
With the help of an example i would explain a very common but erroneous approach new php developers seem to follow (i have seen some ‘old’ ones repeating the same error though). Here it is, Click to continue »
Apr03Better way to write php code – part 1
A few tips on writing php code that can save a php developer a lot of future troubles and “huffs and puffs” occurring due to different php compiler settings, changing of hosting environment etc. Here is first one. Click to continue »
Dec10Clear template cache in x-cart
Have you been making changing into a smarty template file (within x-cart and perhaps independently as well) for long and the changes would not come up at all? Who could tell better how frustrating this can be!
The simplest and most effective way to clear template cache in x-cart is to call cleanup.php file which is placed at the root directory of x-cart installation. So if your installation is inside public_html directory (have nothing to do with directory actually) and your website address is http://www.devarticles.in just call http://www.devarticles.in/cleanup.php and all your template cache will be cleared with a message something like this:
The compiled templates cache (“templates_c” directory) has been cleaned up.
(Thanks to Steve for his post)
Sep17Resetting array keys after unsettling a few of them
I have felt this need quite a few times in the past as well.
I have an array: Click to continue »
May27MYSQL custom sorting – order by field value
Yesterday i had a somewhat new (for me ) and different kind of requirement while displaying MySQL result on a page. I had a category menu in which masters and slaves were sorted alphabetically and in ascending order. Click to continue »
Apr02Spliting CSV (comma seperated) entry grouped by double quotes
By using fgetcsv function we can have well formatted output for csv data without any pain. If you don’t want to use fgetcsv function for some reason and your CSV comma separated entries may contain comma inside except the delimiters, here is a quick alternate. Click to continue »





