Sunday, April 30, 2017 07:04 am EDT
Email address validation is a very common thing and it's pretty easy in php 5.2 or greater. You no longer need to use a regular expression. You can use this simple script below, making use of the filter_var function.
$email = 'email@example.com';
$validation = filter_var($email, FILTER_VALIDATE_EMAIL);
$output = 'proper email address';
$output = 'wrong email address';
Chances are that you have wanted to create a new template as you work on your Drupal sites. Perhaps the blog page needs to have some markup that varies from your typical page.tpl.php template. Adding some lines of code to the template.php file inside the theme you are using can help you achieve this. By default Drupal will look for templates that match the name of a content type. For example, if you created a template called
node-blog.tpl.php, Drupal would recognize it and load it on pages that contained blog content.
Have you ever wanted to add a new region to the theme your using? Well in Drupal 6 you can, and it's not very difficult. A region is a section of your template where information, such as blocks, can be placed. By default there are 5 pre-defined regions. They are as follows:
As you might already know, you can pick which content types contain the $submitted by information that Drupal includes. If you are not already aware, you can go to admin/build/themes/settings/global and choose which content types you would like to have that information. As you add new content types, revisit this page to alter the settings.
The drupal core comes with a Recent Comments module, as you probably already know. This module doesn't allow for any configuration options, so I simply added to it. The core module is a block module that simply shows the 10 most recent comments. But what if you only want to show 5 posts, or perhaps only show comments from a particular content type? Below are the changes that i made. The majority of this code came directly from the drupal core comment.module file.