1

i know you can crate custom tpl files for a specific page by doing the following:

html--node-999.tpl.php

But this doesnt work well if the node-id is going to change when switching environments or migrating stuff. What is the file naming convention for drupal 7 tpl's that are URL Path specific?

3
  • I would suggest that if you need to do this you haven't been specific enough with your content types. I would create a new content type for this specific template. I'm also curious why you need a different html.tpl.php for different nodes? Commented Apr 15, 2015 at 9:45
  • its actually for a one off page that doesnt have to do with any other content type. which is why i think a tpl file specific to this would be fine. Commented Apr 15, 2015 at 20:30
  • Would Context help? i.e. use a path to set the context and take an appropriate action Commented Apr 16, 2015 at 9:13

2 Answers 2

1

Happened upon this old question that didn't have a completely legit answer.

In short, you can set up templates based on path by using the formulae...

page--[front|internal/path].tpl.php

Put simply, if you want a specific page template for a custom page with a url of support, you would create a template named

page--support.tpl.php

or support/contact would be

page--support--contact.tpl.php

Of course you can and probably should use the node--[type|nodeid].tpl.php pattern if you are dealing with node pages. But creating a template based on path is definitely possible.

0

There is no page--[path].tpl.php or node--[path].tpl.php template name schema that will let you create a url-specific template, but you can do it through a pre-process function.

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.