How To

Zyxware default image3
| 3 min read
Highcharts is a charting library written in pure HTML5/JavaScript. Without generating an image we can display a graph using the library. I have a requirement to generate a graph on one of my Drupal projects. In my situation, I have to generate a graph depend on user filtered data. So I choose javascript to generate graphs, it will increase the performance also. Otherw ise, it will increase the server load (if I generate a graph as an image.). Read on to know how to integrate Highcharts in Drupal
Zyxware default image2
| 5 min read
Consider a case where you want to enter regular expression and validate it. Here I will show you how to write a validation function. For example consider YOURMODULE_admin_settings_validate function In my example I am using a form and a submit button.From $form_state array you can get the input value after submit. You need this value to match with the string. See the code below.
Zyxware default image1
| 4 min read
We encountered a situation when developing a Drupal site where our client website had been recently migrated to a new server. We had been using git as our version control system for almost all of our Drupal projects and this one was no exception. Now the new server did not have git installed and we needed one very quickly. So instead of requesting a support ticket and waiting for a response we decided to install git manually. Read on to know how to compile and install git on a live server.
Zyxware default image2
| 3 min read
Lines of code is typically indicative of effort that goes towards software development. So how do you count lines of code in your PHP application (or for that matter any specific types of files in any application). You can't manually open and count files, that would be a big waste of time. The *nix shell has a powerful set of tools that can help you count lines without having to do it manually. find . -name "*.php" | xargs wc -l | awk '{print $1}' | awk '{total = total + $1}END{print total}'
Zyxware default image2
| 3 min read
If you frequently have to set up git version control system for existing projects then you would very likely run into the problem of having to remove files, which should not have been in git, from git after they were added. Running a git rm will only delete the file from the head and the file would still remain in the repository. This may be alright for small files but this could be troublesome for large files as these would unnecessarily bloat the git repository. But don't worry git being a 'swiss army knife' of version control systems there is a solution to delete files permanently from both your local and remote git repositories.
Zyxware default image3
| 3 min read
What do you do if you have to take your Drupal site into maintenance mode from the command line? Well you can do this easily if you have drush set up on your server. With drush you can do quite a lot powerful drupal administration tasks right from the command line. In Drupal 6 The following drush command will take your Drupal site offline drush vset site_offline 1 The following drush command will take your Drupal site back online drush vdel site_offline In Drupal 7
Zyxware default image3
| 2 min read
On one of our recent Drupal projects we came across an issue where the file browse button was not triggering the file selection dialog in IE10 in Windows 8. The problem was diagnosed to be the result of jquery not getting the click event from the button. The site was using jquery 1.44 and this problem is supposed to be fixed in later versions of jquery.
Zyxware default image2
| 3 min read
One of the challenges with working with dynamic websites is that you have to keep fighting malicious users who regularly sap your server capacity with rogue crawling of your site. To do this you would have to monitor and analyze the traffic patterns on the server regularly. You would definitely want to do this when you have load spikes on the server and you wish to find out the IP addresses, user agents and the specific URLs which resulted in these spikes.
Zyxware default image1
| 4 min read
Those of you who have been regularly visiting this site would have started seeing small changes in the site related to how it integrates with social media sites. I have been experimenting on how to increase the interactions between us and the visitors on the site as well as between visitors on the site. This is still a work in progress but I wanted to share with you some of the things I have changed on the site
Zyxware default image3
| 4 min read
In this article I am going to tell you how to redirect anonymous users to a login form on 403 access denied pages in Drupal. There are some contributed module that provides you this feature but, if you really want to create a custom one for your site just try this. Here I will show you a PHP snippet that redirecting to login page for anonymous users on access denied.
Zyxware default image3
| 4 min read
The first thing that you have to do when you want to improve something is to understand what is it that you are trying to improve. To do that you have to have some way of putting that thing which you are trying to improve into a quantity you can measure and get some kind of numbers on. This is applicable not just for your web traffic or social media marketing efforts but with anything (or rather most things) you do in your business.
Zyxware default image4
| 5 min read
If you are in the habit of running queries directly on your production database to generate custom reports then you will run into the requirement of having to connect to your Drupal database on the Acquia cloud hosting. One of our clients wanted to do this and this is how we got this working for them. When you host your Drupal site on the Acquia cloud your site resides on a set of different VPSes that runs Varnish, Apache, MySQL and memcache. Additionally you have your staging server, your development server as well as your production servers - all of them being VPSes.
Zyxware default image1
| 2 min read
Sometimes we use Drupal view_query_alter to add or modify the view's where clause. To add a new WHERE clause we may use add_where property. Whenever we use an add_where, it will create a WHERE clause along with an AND condition. There will be some cases were we need to use OR instead of AND. So if you want to know more about how to use OR clause in hook_view_query_alter, read on to know more.