- [CakePHP] A slightly modified QRcode Helper
I was working on a project where I needed a helper to create QRcode by various methods. After searching I found a good CakePHP QRcode Helper by Max Dörfler which helped me a lot but few functions were still missing in that, like generating QRcode for Wifi network. The allowed contents are: free text contacts […]
- How to track SQL errors in CakePHP on production site
In a CakePHP application, if there is any SQL error and debug level is set to greater than 0, then the complete error message from the database is displayed on the screen, but if the debug is set to 0 it just gives something like “unable to add” or worse a blank page. This can […]
- [CakePHP] Sending emails more robustly
Sending emails in CakePHP using the Email component is a straight forward job. You will find ample documentation about it in the cakephp cookbook. It is a simple and easy to use component. However, one common mistake most of us make is writing the same code to configure the email component at numerous places throughout […]
- [How To] Implement Facebook Like button on web page
This post is more a note to myself than a blog post. There are two Like button implementations: XFBML and Iframe. The XFBML version is more versatile, but requires use of the JavaScript SDK We can use one of the following codes to display a Facebook Like button on our site. Iframe : PLAIN TEXT […]
- [CakePHP] Pagination options persistence
Editing a record and redirecting to a paginated list is a very common workflow pattern in CakePHP. However there is a small problem with this pattern if used with default pagination. after editing the user is always returned to to the first page with the default order and default limit. This is not very user […]
Tag: php
Last month @ SANIsoft blog June 1, 2011
- [CakePHP] Organizing themes in sub-folders
CakePHP offers a wonderful built-in theming solution. However, the only shortfall is that all themes are to be kept in a single folder and there is no direct way to organize them in sub-folders. This post assumes that you are familiar with CakePHP Theming concepts. If not, then head on to the book before reading […]
- Geo-distance search in Sphinx
A common scenario in many search applications is geo-distance based searches. Geo-distance search means finding geographic locations nearby to the specified point on earth. Geo distance search is a very common feature in applications involving set of entities each having a specific geographic coordinate associated with it. Some examples are real estate portals, property listings, […]
Last month @ SANIsoft blog May 1, 2011
- [How To] Create a component in Joomla – Part II
In my last blog post I wrote about How To Create a component in Joomla. The output text was hardcoded into the view. This doesn’t follow the MVC pattern exactly because the view is intended to only display the data, and not contain it. In this second part of the tutorial we will demonstrate how […]
- [CakePHP] Back port Helper aliasing to CakePHP 1.2 and 1.3
One of the enticing new features of CakePHP 2 is Aliasing. What do you do if you need aliasing in CakePHP 1.2 or 1.3? Here is a guide to back port aliasing for helpers. For this guide we will overwrite HTML helper’s link method to always avoid escaping of the title. To start with you […]
- [CakePHP] Saving HABTM data with tables in different databases
One of the powerful features of CakePHP is the model relationships. It handles relationships seamlessly and saves/finds data of related models on its own. The most complex among the relationship is the Has And Belongs To Many, often shortened as HABTM Recently I faced a problem in saving data for a HABTM model. The problem […]
Last month @ SANIsoft blog April 1, 2011
- Announcing the release of Sphinx Search book
Many of you must be following my posts on Sphinx Search Engine over the past one year or so. Well, today I am happy to announce the release of my book Sphinx Search – Beginner’s Guide published by Packt Publishing. The book was released earlier this month, that is, March 2011. As the name suggests, […]
- [How To] Create a component in Joomla
Its really very easy to create a component for Joomla but the question often gets asked again and again. Lets see a simple example to create a component in joomla, which will output a simple text “Hello World”. For our basic component, we only require four files. First start with creating a com_hello folder in […]
- Introduction to using Zend_DB for database abstraction
Welcome back! Today we are going to look into database abstraction layer of one of the most popular MVC frameworks out there. Yes, you are right the framework is Zend framework and the component we will look at is Zend_DB. While Zend_DB is an important part of the framework, one of the best parts of […]
- Extended query syntax in Sphinx search engine
We have been discussing sphinx for the past several months and have seen how to install it, how to perform a full-text search and how to update the indexes. Being a full-text search engine, Sphinx supports different matching modes to cater variety of searching needs. The default matching mode used (if not set explicitly) is […]
Last month @ SANIsoft blog March 1, 2011
- [CakePHP] How to show ‘all’ records options while still using paginate
Admittedly this is a marginal case but recently a client wanted to show “All” records along with a list of ‘per page’ options for paginated records, for example, something like ‘2, 5, 10, 25, 50, 100, All’ or you need to use ‘field sort’ feature of pagination while displaying all records. So, following is a […]
- [How to] Using wp_redirect() without getting errors
Recently I worked on a wordpress plugin where I want to redirect users to the listing page after the data gets successfully saved into the database table. To redirect users to a different page generally we use wp_redirect() function available in wordpress. I tried using the same wp_redirect() function using following code. PLAIN TEXT PHP: […]
- Overview of the new SPL features in PHP 5.3
Today we take a look at another powerful yet still neglected feature that’s part of the PHP 5.3’s stable. It is the latest offerings in the SPL (Standard PHP Library). While SPL has been around since a long time with PHP 5.3, some useful features were introduced. While they might not be the sexiest thing […]
- [HowTo] Page expire on browser back/reload in CakePHP
You might have seen this on many banking sites that the navigation has to be done only via the links and buttons provided on the webpage and if a user clicks the browser’s back or reload button, it shows a page expired error. Let’s see how it can be done in CakePHP. We will set […]
Last month @ SANIsoft blog February 1, 2011
- [How to] Optgroups in select for Drupal CCK module
Many times we have taxonomy terms with parent/child relation with requirement that only the child taxonomy should be selected while adding a new content. One such case is Category/Albums in a photo gallery where one must select an album while adding a photo but category plays an important role in grouping the albums. Most of […]
- [CakePHP] Custom Configuration variables
Many a times we need to define variables in such a manner that we can use them throughout our application. Some people wrongly call them Global Variables but I guess the right term would be Configuration Settings or Configuration Variables Some examples for such settings are: “From” to be used while sending emails Access keys […]
- [CakePHP] Configure cache parameters for core and model
Happy New Year to everyone and welcome to my first post of the year. Many times you need to have a look at total number of seconds taken by SQL queries in a CakePHP application. It’s cumbersome to scroll a long list of SQL queries every time and if the application has a lot of […]
- [WordPress Plugin] iPad Swipe
Most WordPress themes look just fine when you view them in an iPad but what every iPad user gets very soon used is swiping across to turn pages. I thought it would be a good addition for any WordPress blog to be able to provide this functionality via a plugin and a good programming exercise […]
- Drupal 7 Release Party, Nagpur, India
It was the 8th of January 2010, the big day had arrived. It was Drupal 7 Release Party – Nagpur edition. This was certainly one of the most awaited event of the new year. Drupal 7 had released a couple of days back and just like developers all over the world, Drupal community in Nagpur […]
- Introduction to creating desktop applications with PHP and Titanium
Welcome back! and a very Happy New Year. Yes, you saw it right. The post is about creating desktop applications with the help of PHP. And No, we are not using PHP-GTK. You can now create desktop applications without learning a completely new programming language! That is with the help of a free and open source […]Now this was a post which generated a record number of hits on the site
Last month @ SANIsoft blog January 1, 2011
- [How To] Live index updates in Sphinx search
Sphinx search engine can index huge databases with ease and speed. However, when new data (in database or the configured data source) comes in, there is no point in re-indexing everything again and waste our CPU cycles and other resources. Sphinx offers live (almost real time) index updates using a technique called as main+delta scheme. […]
- [How To] Create content type with CCK fields from your custom module in Drupal
In the previous post, Sumit wrote about creating content type through custom module. Creating the content type this way allows you to distribute your custom content type easily without asking your users to create the content type manually before installing your module. But what if you have a complex content type created with lots of […]
- [CakePHP – How To] CKFinder configuration management using component
Hello guyz, I am back again with an article on CakePHP. This one is related to CKFinder configuration management. CKFinder is a file management plugin for CKEditor using which you can upload new files or use existing files to link in to CKEditor’s content. There is a config.php in CKFinder’s directory which has many configuration […]
Last month @ SANIsoft blog December 1, 2010
- [How To] Post data using PHP streams
Recently, I needed to work on a project that needed to post information to another site without the user actually leaving the site and I needed to do this more than thrice and to different urls ! And I did it! Any guesses how ? What ? Ajax ? No! ? CURL you say ? […]
- [How To]Use user-defined variable in MySQL LIMIT clause
Recently, I got a situation where I needed to select only the first 50% (half) records from a database table. The constraint was that I could not use programming language to add a variable to the MySQL limit clause. Under normal circumstances the code would look something like this PLAIN TEXT PHP: // Connect to […]
- [Drupal] Replace default content title with custom field
Recently I had a requirement of allowing the user to choose the date while creating a new content in Drupal site and that date should be treated as a content title. Using CCK and the Date module, it was easy to add a date field with nice looking jQuery datepicker to the new content type. […]
- jCrop Demo using PHP
This is one more post in my ‘image manipulation using PHP’ series. This one uses jCrop, a jQuery plugin, which provides the quick and easy way to add image cropping functionality to your web application. Most of the people understand what the image cropping is, hence I am jumping to the demo of it by […]
Last month @ SANIsoft blog November 1, 2010
- [HowTo] Backup and Restore MySql Databases
Do you have a backup of your important mysql databases ? No ? Think about it .. What if you have a Operating System / Filesystem crash ? What if your databases get corrupted due to some reason ? What if you accidentally drop your database or some important tables ? What if you want […]
- [CakePHP] Sending JSON data in response to a controller action
In my last post we saw a very simple trick to set javascript variables from controller action so that they are available in the javascript files. On the same lines a very common requirement is sending JSON data as output of the controller action. This is mainly required for those actions which are called by […]
- Introduction to jqGrid jQuery plugin
‘Data’ is an important term and a backbone for any dynamic web applicaiton. And for that reason, there are no two ways to say that data representation has been a crucial factor in web application development. As we know that there are enormous methods to represent data in any system but what matters is efficiency, […]
- Lambda functions and Closures in PHP 5.3
PHP 5.3 has introduced a whole new range of cool features like Namespaces, late static binding, new error levels, to name a few. But the functionality that I found most handy for day to day programming is the Lambda functions and Closures that found their way in PHP through version 5.3 Lambda functions Lambda functions […]
- [How To] Use of image magick instead of GD for run-time image re-sizing
In my last post, we looked at a way to re-size images at run time. That method used PHP’s built-in GD library for image processing. So it may happen that image processing may increase load on HTTP server. That’s why in this post I am going to tell the way to use ImageMagick for image […]
Last month @ SANIsoft blog October 1, 2010
- [Getting Started] Functional tests using Selenium Remote Control (RC)
If you don’t like testing your application, most likely your users won’t like to test it either. If you have read my last post on Selenium IDE or have used Selenium IDE before read on, we are moving into the next level, if you have not I really recommend reading this post or update yourself […]
- [CakePHP] Passing data from controller to javascript files
These days javascript is becoming the indispensable tool for a web developer. Each and every web application uses javascript for one or the other purpose. While working with CakePHP based projects, we need to pass variables from PHP (controller) to javascript a lot of times. To pass a variable from controller to view, Controller::set() method […]
- [HowTo] Retrieve your Gmail emails using simple IMAP protocol
While developing applications in PHP, I might have used the simple mail() number of times to create an interface to send emails across the web. On a normal working day, I just woke up in the morning and thought, “Is there any chance for me to retrieve emails from any mail service provider like Gmail??” […]
- [iPhone] Core Data, Tabbar and Navigation Controller
Core Data is a very powerful framework for persistent data management for iPhone developers. It allows you to define you data model by abstracting your model object. I am not going to talk about what Core Data is about and how to use it normally. A lot has been already written about it. Feel free […]