Strange behaviour of drupal 6 triggers and CCK default values

Leave a comment

One of my drupal experience is to developing an application for a client.So i want to change the default behaviour of drupal after saving the post.I created a trigger which triggers after saving the post to Redirect the admin/content/node Url.But the bad behaviour is starts there.The application dont save default values,but after editing and save it saves the values.So i used a hook_nodeapi to get the values from submitted form and try to save it.But ‘mymodule_nodeapi’ not fires at all.Before that it redirect to the ‘triggered Url’.After many hours of  research, trial,  i found the redirect nature and Un assign the Trigger .Now it works perfectly.

Buti am not 100% sure if it only related to that trigger or some thing related to configuration of trigger.

i will update my further finding and experience of drupal as application frame work in future


Template suggestions drupal

Leave a comment

How to change the template when we show a node using view

we have placed a view for show details of each node in drupal 6 with a path of the view as ‘node/%’.But web site contains a system of multiple blogs using advanced_blog and custom module for manage some extra functionality for blog pages according to the blog html template.i prefer to add a template for blog and named it as page-blog.tpl.php.and all path of the blog is aliased with ‘blog/’.Every thing is working fine until when i click link to view the detials of a blog entry.It fallbacks to default page.tpl.php for showing the details.But i want to remain on the page-blog page.So i used the follwing script with ‘path’ module
//put this script in template.php if exist preprocess_page then only //insert contents of function:
function phptemplate_preprocess_page(&$vars) {
if ($vars[‘is_front’] != 1) {
$vars[‘template_files’][] = ‘page-‘ . $vars[‘node’]->type;
if (module_exists(‘path’)) {
$alias = drupal_get_path_alias(str_replace(‘/edit’,”,$_GET[‘q’]));
if ($alias != $_GET[‘q’]) {
$template_filename = ‘page’;
foreach (explode(‘/’, $alias) as $path_part) {
$template_filename = $template_filename . ‘-‘ . $path_part;
$vars[‘template_files’][] = $template_filename;

this function creates all possible combinations of templates suggestions to drupal.And in that page i use module_invoke for getting the results

How to pass values to existing drupal filters

Leave a comment

‘nid’ is the field used in my view for filter and following is my code for give a value to filter
$BlogSelected contains blog id showed as first blog,the view shows rest of the blog items

$view = views_get_view(“View_Blog_User_Archivio”);
$display_id = ‘default’;
$item = $view->get_item($display_id, ‘filter’, ‘nid’);
$item[‘value’] = $BlogSelected;
$view->set_item($display_id, ‘filter’, ‘nid’, $item);
$view->is_cacheable = FALSE;


$output = $view->render();

How to create custom tags in drupal(Like wordpress)

Leave a comment

Create a vocabulary with ‘tags’ checkbox checked(Terms are created by users when submitting posts by typing a comma separated list.).

And Follow this link-

custom cck check box and default values and label

Leave a comment

For making cck check box field with label and default value,tricky way is there.You must pass ‘Allowed values list:’ as a key value pair separated with ‘|’.



Then it shows proper label when editing the story.