By JonMB on
Hi all,
I have created a content type called "static page," which I plan to use for something different than the normal "page" content type.
I want to give the Static Page content a completely different layout than the Page content.
I read about creating a node-static.tpl.php file, and I did, but this doesn't seem to let me change the whole layout in the same way that the page.tpl.php file does.
I tried creating a page-static.tpl.php file, but that doesn't seem to do anything.
Any suggestions? Thanks!
Comments
Note: I know I can create a
Note: I know I can create a page.tpl.php file for each specific node, but that is very tedious and inefficient for hundreds of pages. I want to be able to apply everything to a new content type instead.
Contemplate allows for some
Contemplate allows for some incredible customization of full nodes, teasers, and RSS feeds on a per-content-type basis.
I just tried creating a
@amariotti, thanks for your suggestion. I may end up using that, but is there not a simple non-Module approach?
I just tried creating a "page-node-static.tpl.php" file, but that does nothing. Then I created "page-node-43.tpl.php" and that does work, but this is calling the specific node id instead of its content type. Like I said earlier, this would be bad if I have hundreds of pages.
You can create any manner of
You can create any manner of template files you need, see: Working with template suggestions.
Another option is the panels module, see: Panels 2: Create a node override
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
Ah, perfect. Thanks very
Ah, perfect. Thanks very much. I'm surprised I didn't find that myself!
welcome ;-) === "Give a man
welcome ;-)
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
I'm having an issue creating
I'm having an issue creating more than one, though. Using the suggesting from the link Working with template suggestions, I added this to my template.php file:
And this works fine for one content type. But I have four content types I want to theme, so I tried adding it in four times.
Now I receive this error when trying to load my site: Fatal error: Cannot redeclare newsflash_preprocess_page() (previously declared in /home/www/drupal/themes/newsflash/template.php:123) in /home/www/drupal/themes/newsflash/template.php on line 133
Any ideas? How do I theme multiple content types, instead of just an additional one?
Nevermind. For some reason
Nevermind. For some reason in my fairyland head I seem to think I can repeat functions. For anyone wondering, this is the correct code to use if you have multiple content types:
Notice the different content types I have: news, static, jokes, codes.
lol, good job ;-) === "Give
lol, good job ;-)
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
great work
just what i needed now, community is great. if only experts were more involved, seems that i find good solution often that are dug out by non-experts :-)
I have a content type
I have a content type (machine name): article / Zen subtheme name: tdl / tpl file: page-node-article.tpl.php
I cannot seem to get this working. Here's what I have in my sub themes template file:
I am trying to them all article node pages. Here's an example of the page I want to theme: http://davianletter.com/tdl/articles/test-article
Trying copying the
Trying copying the page.tpl.php file from the main theme into the subtheme's directory as well-- then clear the cache.
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
Ryan, I love that theme! Way
Ryan, I love that theme! Way to go. Interested in giving it back to the community any time soon? ;)
Read
Read http://drupal.org/node/249726">Different page templates depending on node type