Drupal Blog

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.)

blog: 

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. 
 
Nodes from Content Type 1 have various terms assigned. For example, node/143 has the following terms assigned: term 2, term 4, and terms 6 & 7.
 

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:

[konordo@konordo ~]# drush status
<strong>PHP Fatal error:  Class 'Console_Table' not found in drush/path/drush.inc on line 955 </strong>

The solution was to install the php pear extension

How to install drush

In this example, we will install drush under the directory /usr/local/share/. The path is not really important as long as you adjust the following commands accordingly.

If the directories do not exists, we create them:

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...



Recent Comments

Forward by Dries Buytaert, Founder and Project Lead, Drupal; CTO Acquia.

Order now from:

Managing Expectations Podcast with DrupalEasy

Author Interview http://tinyurl.com/8a8nxno

We provide the most Shiny Drupal Bits & Pixels

Since Drupal 4.x

© 2014 Konordo Limited
Drupal Services provider.
All rights reserved.

Reg Nr. 12301661F
VAT Nr. CY10301661D

M. Director: Konstantin Ordoulidis

 

Get in touch

  • Omirou 10, 3095, Limassol, Cyprus
  • +4917698807355
  • info [at] konordo [dot] com

Submit
randomness