I have 2 sections that are accessed as section1, section2 that have thier own node templates. Each section has a resource subsection, which should share a node template (node--resources.tpl.php).

How can I configure my url using Pathauto such that urls section1/resources and section2/resources, both use the node--resource.tpl.php? Is this possible? All attempts have failed.

1 Answer 1


You can define custom tokens such that they can be replaced by pathauto.

See Implementation with a custom Module

The idea is to define tokens such that they get displayed in pathauto's admin page. and we manage the token from our code; after checking conditions.

AS OP's request here's my D6 code that i've implemented.

function MODULENAME_token_list($type = 'all') {
  $tokens['MODULENAME']['fullname'] = 'The Use\'r Display Name';
  return $tokens;

function MODULENAME_token_values($type, $object = NULL, $options = array()) {
  $tokens['fullname'] = _MODULENAME_get_display_name($object->uid);
  return $tokens;

function _MODULENAME_get_display_name($uid) {
  //load corresponding user and  get $displayname 
  return $displayname;
  • Thanks Nikhil. This helps, but I'm still unsure where and how I get the tokens to then be able to load the shared node--resources.tpl. Sorry for being dense.
    – David
    Apr 30, 2012 at 5:08
  • @David See my edit. Hope its helps more.
    – niksmac
    Apr 30, 2012 at 5:35
  • This helps Nikhil, thanks. I'm going to mark this as answered as it does answer the question regarding pathauto and url. I phrased the question poorly, sorry. What I was actually looking for was very simple, but maybe easy for a Drupal newb like myself to miss. In order to make both nodes use the custom template node they must both be of the same content type AND the custom template should be called node--CONTENT_TYPE.tpl.php.
    – David
    Apr 30, 2012 at 19:46
  • @David Yeah of course. node--[type|nodeid].tpl.php means tpl for content type type or node nodeid.
    – niksmac
    May 1, 2012 at 3:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.