preg_match date time validation
While developing a custom module, I needed to validate the following date time format:
1987-11-22T23:52:12
The following code was used to create a pattern for the preg_match and to test the results. (Can be used as is.)
Show taxonomy terms Grouped By Taxonomy Parent
Lately I was assigned with the task to display all terms assigned to a node, grouped by their parent. To better explain this, let's say for example that we have the Vocabulary 1 assigned to Content Type A, with the following terms:
Parent 1
-- term 1
-- term 2
-- term 3
Parent 2
-- term 4
-- term 5
Parent 3
-- term 6
-- term 7
etc.
Show Blocks only on user's pages and not on login, edit etc. pages
If we need to display a block in user pages, and not in /user/login or /user/register etc pages, we need to field in some custom php code under the Page specific visibility settings, we select the radio "Show if the following PHP code returns TRUE (PHP-mode, experts only)" and we fill in the following code:
PHP Fatal error: Class 'Console_Table' not found in... drush error
After a fresh drush installation, drush status returned this error message:
How to install drush
sudo mkdir /usr/local/share/
sudo mkdir /usr/local/bin/
And now it time to download and extract drush. Make sure that you have the latest version available and replace the url in the command accordingly.
We also create a symlink so that we can use it everywhere without typing the parent path all the time...
Views: Display all nodes that have sibling terms (i.e. terms under the same parent) .
While working on an extra requirement for metalera.gr, we needed to do the following:
When viewing node/xxx, we would like to display all nodes that have terms that belong to the same parent as the one we currently visit. Let's say for example, that we have the following parent:
Colors
--red
--blue
--green
Node/xxx has the term green assigned. We need our view to display all nodes that have red or blue as well.
To achieve that, we first create a new view, then:
Views: How to exclude current node from output
In Drupal 6 there is a very easy way to exclude the current node from the views output.
How to create divs with rounded corners, using only a lightweight circle graphic and a combination of xHTML/CSS
How to install APC & Uploadprogress on Centos 5
yum install php-pear
Then, we are making availlable a required package for the phpize command:
yum install php-devel
The followng package will allow apxs command:
yum install httpd-devel
Once we have all the above pakages installed, we are ready to install apc by running the pecl command:
pecl install apc