Friday, December 10, 2010

Drupal: Add a Command-line Interface with the Drush Module

The Drush module for Drupal allows you to have a command-line interface and a scripting environment for your Drupal website if you are accustomed to using the command prompt (mostly available to dedicated and virtual private servers). drush means Drupal Shell.

Tuesday, November 30, 2010

PHP: How to Scrape Websites using Simple HTML DOM Parser

Scraping websites or Web scraping is a method of collecting data off from websites using a program to automate the process. Wikipedia defines it as "a computer software technique of extracting information from websites." For whatever purpose it may be, the creation of web scraping PHP scripts has been made easier using this PHP class for parsing HTML content. From the PHP Simple HTML DOM Parser website:

  • A HTML DOM parser written in PHP5+ let you manipulate HTML in a very easy way!

  • Require PHP 5+.

  • Supports invalid HTML.

  • Find tags on an HTML page with selectors just like jQuery.

  • Extract contents from HTML in a single line.



I have used this class several times already in some of my projects and it does work well. Below are some sample codes:

Monday, November 15, 2010

Drupal: Easy Themeing with Fusion

The more I'm using Drupal, the better I understand why a lot of developers choose it as a top choice when it comes to creating community-driven websites. And another great tool at our dispense for creating Drupal sites is the Fusion theme.

Sunday, October 17, 2010

Drupal SEO Checklist

Almost every CMS nowadays have an SEO module or plugin of some sort. For Drupal, we have one of the most comprehensive Search Engine Optimization module known as the SEO Checklist. Its actually a checklist of the modules or actions you need to take to make sure that your Drupal site is in tip-top SEO shape!

It servers as your SEO command center for Drupal, where you check out modules or actions that you have already completed and also has the Download and Configure links to various SEO modules. The current version has also added some Performance modules you need to optimize your Drupal site's page loading times.

Here are the contents of the SEO checklist:

Saturday, October 09, 2010

PHP Function to Validate Credit Card Numbers

Here is a very simple credit card number validation function for your PHP needs. This will simply check if the credit card number you placed is a valid number, this won't check if that certain credit card has available funds, or is even a REAL credit card. That should be handled by the payment processor you have for your site.

Tuesday, October 05, 2010

Drupal: Sending an Email using the drupal_mail function

Here's a code snippet that shows you how to use the drupal_mail function to send an email. First, define a callback function that will handle the creation of the message. NOTE: this function must end with "_mail"

Saturday, October 02, 2010

Drupal: Create User Accounts Through the Webform Module

There are various ways to create user accounts through Drupal, but if you need to integrate it with a Webform (required: Webform module), maybe you have also stumbled through http://drupal.org/project/webform_register and to your surpirse, there is no module for download! So here are some helpful lines of code that could get you by that I found from the "Recent issues" page of the said module:

Dancing Cebu Pacific Flight Attendants Gets Posted on Gizmodo


Cebu Pacific flight attendants giving instructions to the music of Lady Gaga and Katy Perry.


This video was just posted last September 30, already got +1,800,000 views! Despite all those legendary delayed and re-routed flights, Cebu Pacific just got some stint on one of the most popular gadget blog, Gizmodo. You can view their post here.

Thursday, September 30, 2010

Drupal 6: How to Embed a View Into a Template

For Drupal: If you need to embed a view inside a template file, a few lines of code is what you need. Lets take a look at the first solution based on the manual:

Wednesday, September 15, 2010

PHP Redirect Visitors to Another Domain or Subdomain Based on Country

Redirecting visitors to a different domain based on the country of origin is one way to consolidate language translations. For example, I have a site at asdfg.com, and I want Australian visitors to be redirected to asdfg.com.au and UK visitors to be redirected to asdfg.co.uk , I can easily do that with a little PHP and a module called GeoIP. Here are the steps: