By mz906 on
I have a custom node.tpl.php and i'm working on creating a custom page.tpl.php, my question is this:
is there a more logical way to name your page.tpl.php files? for example, a custom node for cck type about would be:
node-about.tpl.php
and the page would be:
page-node-150.tpl.php
is there away to reference the content type in the page.tpl.php name like:
page-node-about.tpl.php
i've been trying names and nothing seems to work.
Comments
The reason that your new
The reason that your new templates do not work, is that there is a strict list of filenames that are checked. This is described in phptemplate_page() in phptemplate.engine:
However, all is not lost: when the framework does the actual templating, this list is passed, but your theme is able to add suggestions to the list! You can do this, by implementing/adding the function _phptemplate_variables() in your theme. Something like this:
You suggestions (page-node-story for example) will be used BEFORE the other suggestions. Make sure you don't damage the code that already exists in this function! (by returning from the function too early, by example). Phew! This answer took longer than expected!
code above did not work... but
code above did not work... but with a wee tweak it did. See here under:
Yes, I did my testing using
Yes, I did my testing using garland, which has a bunch more code in that function. That depends on your theme etc. That's why I included the comment "Make sure you don't damage the code that already exists in this function! (by returning from the function too early, by example)". Good luck!