Sometimes we may want to show the number of records in a view. I found a very good snippet which serve this purpose perfectly and you can add it to either view header or footer. Continue reading Drupal – Add View Result Count
Category Archives: CMS
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
Drupal – Introduction to Drupal Theming @ 1
The following module is an example which shows you the simplest way of Drupal themeing.
ykyuen.info Continue reading Drupal – Introduction to Drupal Theming @ 1
Drupal – Get Timestamp from CCK Date Field
By default, the CCK date field was in the following format.
- CCK 2011-10-01T00:00:00
You can get the timestamp from the above the string by the the PHP the strtotime() function. Continue reading Drupal – Get Timestamp from CCK Date Field
Drupal – Get number of nodes of Taxonomy Term by Term ID
In Drupal, you can get the number of nodes of a specific term by
<?php print taxonomy_term_count_nodes($term_id); ?>
Done =)
Reference: StackOverflow – How do I create a node count for each each category term in Drupal?
Drupal – Add Image to Apache Solr Search Result
Apache Solr is a very good web search engine and it works very well with Drupal. This post shows you how to customize the default pure text search result template by adding node image to each result record.
First, we need to load the corresponding node for each search result. This can be done in the <theme>_preprocess_search_result(&$variables) function. Add it to the template.php. Continue reading Drupal – Add Image to Apache Solr Search Result
Drupal – Disable Admin tools menu for other users
I always use Admin Tools in all my Drupal 6 websitea. but by default the Admin tools menu will be shown to all users with Admin Tools access. If you want to limit the it to super admin, apply the following patch.
admin_tools-n934536-d6.patch
Source: Continue reading Drupal – Disable Admin tools menu for other users
Drupal – Disable Menu Settings in Node Edit Form
You can add the menu item on the node edit form but sometimes you may want to hide this feature from other users. So this time you can use the Menu Settings per Content Type module.
Download and enable the module and you can find the following options in the Content Type edit form. Continue reading Drupal – Disable Menu Settings in Node Edit Form