Tag Archives: Drupal Development

Drupal – Get the Number of nodes under a Parent Term

Previously, we talked about how to get the number of nodes of a specific term.
Drupal – Get Number of node of Taxonomy Term by Term ID

How about if i want to get the number of nodes under a specific parent term? Unfortunately, there is no such function. so i try to get that number by SQL. Here is the PHP code.
Continue reading Drupal – Get the Number of nodes under a Parent Term

Drupal – Add Extra jQuery Library

Next: Drupal 7 – Add the latest jQuery on your Drupal 7 without conflicts

The jQuery Update module allows us to update the Drupal 6 core jQuery to 1.3.2. This is definitely not enough for many 3rd party jQuery libraries. If you want to add the latest jQuery without affecting the core script, you can try the following approach which makes use of the jQuery.noConflict() and it is originally written by gala4th in his blog THERE IS NO PLACE LIKE 127.0.0.1.

Ok, now we want to add the new jQuery for a specific content. Let’s follow the custom module we created in Continue reading Drupal – Add Extra jQuery Library

Drupal – Theme node template by module

Suppose we have a content type called Silly Question. We can theme the node template by adding the node-silly_question.tpl.php in the theme folder. But if we are working on a module, we should ask Drupal to read the .tpl.php in our module folder first because we shouldn’t ask the module user to copy the .tpl.php from our module folder to their theme folder.
Continue reading Drupal – Theme node template by module

Drupal – Introduction to Drupal Theming @ 3

Update @ 20130303: For Drupal 7, please refer to the following post.
Drupal 7 – Create your own theme function on your custom block

 

Previous related articles
Drupal – Introduction to Drupal Theming @ 1
Drupal – Introduction to Drupal Theming @ 2

So we could now use a .tpl.php for our customized content. The last thing i would like to mention is about the preprocess function.

Suppose i want to load a node content on the .tpl.php, we can either include the node as an arguments when calling the theme function like. Continue reading Drupal – Introduction to Drupal Theming @ 3

Drupal – Introduction to Drupal Theming @ 2

Yesterday we have talked about the simplest way to theme Drupal content
Drupal – Introduction to Drupal Theming @ 1

But this is not a very good approach because printing inline HTML/PHP inside the theme function is not a good programming practice. This time, i want to create a .tpl.php for the block so we could separate the backend and frontend coding.

Create the following module. Continue reading Drupal – Introduction to Drupal Theming @ 2