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
By default, the CCK date field was in the following format.
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
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?
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
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
i try to install the PHP memcache extension through PECL.
But i get the following error.
running: phpize
sh: phpize: not found
ERROR: `phpize’ failed Continue reading PHP – phpize: command not found
The Quick Tabs allows you to aggregate different content in a single page using tabs. You can either load all the tabs at once or use Ajax to retrieve the tab content. But in both cases, you can’t get the direct link of a specific tab.
So i create the following Javascript to tackle this problem. After applying it, the page will reload every time when the user click the tab and the URL is also updated. Continue reading Drupal – Quick Tabs Deep Linking
The Node Comments module let you assign you own content type as comment. For example, i have the following two content types.
Continue reading Drupal – Render the Node Comments Post a Comment Form
You can render the comment form by the following piece of code.
<?php
print drupal_get_form('comment_form', array('nid' => $nid));
?>
Where $nid is the node id.
Done =)
Reference: Render node comment form on Views page
In Views, we can make the exposed filter into block and therefore we can select it for Panel page. But this would not work because after the filter form submission, it will redirect to the view page rather than the current panel page.
Luckily, i found a solution to resolve the issue. Continue reading Drupal – Form Path Problem of Exposed Filter Block in Panel Page
I would like to add some HTML elements in the login form. This can be done by hook_form_alter() and the markup could be added as follow.
function <your module>_form_alter(&$form, &$form_state, $form_id) {
//print $form_id.'<br/>';
if ($form_id == 'user_login') {
//print_r($form);
$form['html_markup'] = array('#value' => t('<a href="https://ykyuen.wordpress.com">Eureka!</a>'));
}
}
Done =)
Reference: Drupal 6 Form API Reference