I had a requirement where I had to execute shell command from PHP. The requirement was that I had to find details of a domain using commands like whois and then store this information into files in a folder. The only input parameter for the process was the name of the domain which was passed on from the Drupal site. The PHP function (shell_exec) was designed to do things like this.
Technical Solution
We need to develop websites for a variety of mobile devices along with regular desktop versions. To do this effectively we need to detect the mobile devices when they access the website which can be done through Javascript. Read on to know how to detect mobile devices using Javascript
AJAX is now widely used in to web development to make the user interfaces simpler and faster. We may use AJAX to load images after page load in order to increase performance. However if you want to have a lightbox popup with the full image bound to an image loaded by AJAX then you might run into problems. You will find that even after linking the JS, CSS files and adding the rel="lightbox" attribute to the images it might not work.
We had encountered a situation on one of our Drupal sites where we had to create HTML links which on clicking should point to different locations on a different page. We solved this problem by making use of the 'name' attribute of anchor tags. If you are facing the same scenario in your Drupal site and would like to know how to use the 'name' attribute of anchor tags to redirect links to a location on a different page then read on to find out more.
A Drupal user trying to use Drupal Boost for caching their website encountered a strange situation in their Drupal site where enabling the Boost caching system increased the load of their server. If you are encountering a situation in your Drupal site where enabling the Boost caching system increases your server load. then read on to find the solution.
Two important aspects about managing multiple projects with multiple teams are scheduling of the projects & milestones and allocation of resources to these projects. Over the past few years we have been using a simple Google Spreadsheet based utility which we had developed in-house to schedule projects and to allocate resources for projects. We had earlier released this as Free Software under a GPL license and made this available as free template and over 1000 users are currently using this tool.
Colorbox can be used to display content pop-ups. By default, the popup's height and width will be exactly the same as that of the original content. But there may be times, when you want to load the content as per the screen height. This can be done easily using jQuery.
The steps you may follow to achieve this are:
Many a times, IE7 stands out from the group of modern web-browsers owing to its notorious incompatibility with many a standard HTML/CSS/JS. In this article, we are seeing the following case of incompatibility: CSS border for Select (Drop down) element does not work.
On one of my Drupal sites, while validating a form, when a required input field has not been filled before hitting the Submit button, an error message is shown, and the field is highlighted with a red border. The red border was achieved with this CSS:
Many a times, IE7 stands out from the group of modern web-browsers owing to its notorious incompatibility with many a standard HTML/CSS/JS. In this article, we are seeing the following case of incompatibility: In IE7, the CSS 'border-collapse' does not override cell spacing related tags.
While adding content using CKeditor in Drupal, users may add inline CSS to style the content. We can style each element in this content using our CSS to match the design of our site. In the case of table element, if we set HTML attribute cellSpacing on the table, like
Here is a script to help you find empty directories located under a specified parent-folder. The file folders.txt contains the list of folders that are to be passed as input to the script. The script will now check all the folders mentioned in the file folders.txt, and give the list of folders that are empty. The output can either be seen at the terminal or it can be passed to a file via a redirector.
Here is the code for the same:
This is a script to create a particular directory under all subdirectories in a parent directory. Consider the case when a parent directory consists of more than 100 folders and you want create a new folder under all these directories, with the same name. Doing this manually would be a mess. This script would help you do this in no time.
These are the steps for executing the script:
First, add the exact path where the parent directory is present, and the name of the folder that is to be created.
HP has published the price lists for its range of Pavilion Laptops for the month of January 2013.
The function of the script is to rename a specific-directory present under all sub-directories of a specified parent folder. Consider, you have a particular folder under all sub-directories of a folder and you want to rename all of those occurrences. Doing it manually would take much time. Here is a script to make it easy for you.
The script takes the following inputs:
'path' is the absolute path of the parent folder, and
'foldername.txt' is a text file which contains the names of the subdirectories under each of which the specific directory has to be renamed.
Have you ever encountered a situation where you have to find a specific pattern in a string and had to replace it with a new pattern in PHP. You will often encounter such situations during web development or any type of programming. Read on to know how to find a specific pattern in a string and replace it with a new pattern using PHP.
Many Drupal users using Bitnami wanted to know how to create virtual hosts in a Bitnami AMI hosting server. If you are facing the same question with Bitnami for your Drupal site then read on to find out the solution.
The main purpose of a domain-name is to make the website simpler to access. It is easier for users to remember domain names rather than having to remember IP addresses of sites. But do you know that it would be quite useful to remember IPs when the domain name has expired? How would you access a site whose domain name has expired? Most people have no idea about this. This article is here to help.
Enabling the jQuery effects on a page is now no more a mess. Using a plugin called Adipoli, it is as simple as this to show different effects for our content:
Add the necessary js files and css files.
Select the element on which the effect is to be applied.
Invoke the tooltip plugin.
So here is the code:
$(document).ready(function(){
$('.imgsmile').adipoli({
'hoverEffect' : 'popout'
});
});
There are still more effects that you can add up on other than popout:
Almost all the browsers have different settings for base margins and padding. It is always important to set margin and padding for the body and html tags while styling web-pages. Otherwise it might result in some inconsistencies while displaying the pages across various browsers.
We can avoid such inconsistencies by setting margins and paddings on html and body tags to 0.
The Flag module in Drupal allows you to create different flags for your website. But the default settings in flag module will only allow you to display these flags under the user-profile page (if your flag type is user), OR under node page/node teaser/in contextual links (if your flag type is node).
As a web developer, we sometimes may want to export a specific table from a MySQL database. It can be particularly helpful when we are going to apply some changes to a table that is part of a large database and we are interested in backing up that specific table only, rather that whole huge database.
To create a backup (also called dump) of the a table use this command:
mysqldump -u username -p db_name table_name | gzip > db_name.table_name.sql.gzThis will create the backup/dump for the table in the file in compressed format.