So I am trying to add an additional page to garland at http://site.com/processfront, this code does not seem to run and or change the template. I know the code is being run however, since i get an error if i purposefully mess up syntax. But, I tried defining some other arbitrary variables and printing them and that didnt work either... What's going on? Thanks

function phptemplate_preprocess_page(&$vars, $hook) { $vars['tabs2'] = menu_secondary_local_tasks();

if (arg(0) == 'processfront') { $variables['template_file'] = 'page-processfront'; }

1 Answer 1


If processfront is an alias for a specific node, let's say 228, then its system path is really node/228 and arg(0) will be node. If you've set your system up so that this node is your front page, you can just use page-front.tpl.php and drupal will take care of it automagically. Otherwise, you can use drupal_get_path_alias() and check against that.

  • processfront is just an arbitrary url route I made to pull a custom php file at page-processfront.tpl.php
    – A_funs
    Aug 1, 2012 at 15:46
  • I want site.com/processfront to go to the custom page "page-processfront.tpl.php" I put into the theme directory
    – A_funs
    Aug 1, 2012 at 15:47
  • Not really following, but if you want drupal to do something at www.yoursite.com/processfront, you need to create a menu item for it.
    – Jimajamma
    Aug 1, 2012 at 15:49
  • I need to create a menu item even if it will not need to be accessed directly by users? only by script?
    – A_funs
    Aug 1, 2012 at 15:50
  • One side effect of page-ANY-PATH.tpl.php though is that if after you've cleared all caches/rebuilt your theme registry, it will be used for www.yoursite.com/ANY/PATH even if that path doesn't exist on your system. This is ugly though because drupal will have returned a NOT FOUND error to the user's browser.
    – Jimajamma
    Aug 1, 2012 at 15:52

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.