Hi,
I'm setting up a site with a forum, a shop and some simple service pages. I'm using Drupal 5.1 and PHPTemplate. I have created the following page templates:
page-forum.tpl.php - for theming forum pages
page-shop.tpl.php - for theming shop pages
page.tpl.php - for theming all other pages
However, this works only at the "entry level" of the forum but not in forum topics:
?q=forum (forum start page) - uses page-forum.tpl.php
?q=forum/1 (choosing a forum) - uses page-forum.tpl.php
?q=node/1 (opening a forum topic) - uses page.tpl.php but I want it to use page-forum.tpl.php !
I'm not sure as to how I can tell Drupal to use page-forum.tpl.php for all forum pages including topics. The same issue arises in the shop: all shop related pages should use page-shop.tpl.php, not just the first page in the shop.
Do I need to use Pathauto to solve this? If yes, how do I need to configure it? What if I want to use clean URLs?
Thanks for advice!
Comments
Here you go...
This may be what you are looking for (http://drupal.org/node/46027#comment-213839) by bumathan:
:) Isn't that sweet? ;)
=-=
This thread may help as well ... http://drupal.org/node/65171
Switch page template based on node type
Thanks for your inputs. I looked into them and here is what I found:
I can't use the solution using args, because in forum topics none of the args contains "forum". They just contain "node" and a numeric value. So they don't indicate we are in the forum. Apart from that, there is logic in tpl.php that I think should rather be in template.php (as of Drupal 5).
Overriding theme functions provides a perfect way to modify the forum list output (I'll try that later), but it doesn't allow me to switch the page template in forum nodes.
I did some more research and found this solution: Switch the page template based on the node type, which - in the case of forum topics - is "forum". I now have this in my template.php file:
Now all forum nodes use the page-forum.tpl.php template file. Anything wrong with this approach? ;)
Here is where I found information concerning this method:
http://group42.ca/take_control_of_your_phptemplate_variables
http://www.lullabot.com/articles/hacking_phptemplate
http://www.nicklewis.org/node/825
Having the same exact
Having the same exact quandary. I'm trying to get this to work for D6--any ideas? I already have the page-forum.tpl.php working fine for form and forum list, just not the actual forum post nodes.