By gtothab on
Hey,
I'm theming this site and I need a way to have the pages of a certain node type as well as the node creation pages of the same node type display differently than the rest of the site. How do I go about creating custom tpl files for these pages. What I need is not node.tpl files but rather the more granular control afforded by page.tpl files. I'm thinking I would need something like this: page-node_node_type.tpl AND page-node_node_type_add.tpl. How do I achieve this?
Thanks a bunch!
G
Comments
See this page and its
See this page and its comments: http://drupal.org/node/223440#comment-1045201
Awesome
Hey thanks a bunch that worked for the node pages. Any idea how to tweak that code to get something for the node ADD page for that content type? (page-node-my_node_type.tpl.php affects the node's pages as well as the node's edit pages but not the node's creation page)
This is the code I tried adding to my template.php file:
The first if statement is working and allows for the page-node-my_node_type.tpl file. The second is supposed to allow for the add page of that same node type but it dosent work. What do i have wrong?
Appreciate it!
G
I assume that it does not
I assume that it does not work because there is no node loaded on the node-add form. After all, the node still needs to be created, so how could Drupal load the node object into $variables['node'] ?
Fortunately, the node add page always has the same url, so there must already be a template suggestion for it, following the rules on the page I sent you earlier.
Don't delete the second if-statement completely though; you will probably need a similar rule for the node/123/edit url's. When you change 'add' to 'edit' in the second part, you will probably have the edit pages covered.
Got it
Thanks again. I got it.
For all who want a way to theme the node creation page of a certain node type the tpl file name should be: page-node-add-my_node_type_name.tpl.php (I had been trying page-node-my_node_type_name-add.tpl.php to no avail!)
You're welcome. One last tip:
You're welcome. One last tip: if you need to figure out how something was themes and what the template suggestions are, try the devel module and its theme inspector.
thanks
thanks all. This information was helpful.
Cheers