Saturday, February 13, 2010

How to create custom breadcrumb for node pages ?

Write this function on your template.php file in themes folder

function MYTHEME_preprocess_page(&$variables) {
if ($variables['node']->type == 'MYNODETYPE') {

$links = array();

// yet another link
$links[] = l('Some Other Link', 'SOMEOTHERLINK');

// lastly, overwrite the contents of the breadcrumbs variable in the page scope
$variables['breadcrumb'] = theme('breadcrumb', $links);
}
}


Example
function MYTHEME_preprocess_page(&$variables) {
if ($variables['node']->type == 'project') {

$links = array();

// yet another link
$links[] = l('Projects', 'projects');
$links[] = l($variables['node']->title, 'node/'.$variables['node']->nid);

// lastly, overwrite the contents of the breadcrumbs variable in the page scope
$variables['breadcrumb'] = theme('breadcrumb', $links);
}
}

Browse button not seen on image browser

Usually when we install tinymce or fckeditor through WYSIWYG we cant see the browse button. It can be solved by adding the module IMCE Wysiwyg bridge (http://drupal.org/project/imce_wysiwyg). Once you installed this don't forget to select the buttons needed on editor by enabling them in WYSIWYG editor settings