By dresde on
Hello there,
I'm looking for the way to hide the searchbox in all forum pages. It is not a block, so I'm trying to find a way to modify the page.tpl.php for the forum pages. I haven't been able to find how to create something like page-forum.tpl.php so I can just edit that template, so I have tried to use php IF to do it. THis is how my code looks now, but it seems to not be working properly:
<?php if ($node->type != "forum"): ?>
<div class="block block-theme">
<?php print $search_box; ?>
</div>
<?php endif; ?>
Is it wrong? Is there a better way? Is there any option to create that page-forum-tpl-php?
Thank you very much!
Comments
This looks correct at first
This looks correct at first glance. How is it not working? If the box is showing up on the forum pages, are you sure that the node type is exactly "forum"?
If you prefer a separate template, there's a module that does that: http://drupal.org/project/node_page It's also fairly easy to do DYI from the template.php file, using template suggestions.
thanks ;)
Thank you very much Rob,
I don't really know why isn't it working... I'm pretty sure it worked for a while, then I returned to showing the searchbox everywhere and now it doesnt dissapear anymore :S may be some sort of cache memory somewhere.
Anyways, I also have to edit the page template for the forum for other reasons, so may be it's easier to just build a new template without the searchbox on it... no coding involved, hehehe.
BTW, the module will help to create a diferent page.tpl.php or a different node.tpl.php? The part I'm working in refers only to the page.tpl.php, so I need to change that one only :)
The module allows you to have
The module allows you to have a different page template for a node type, so for example page-forum.tpl.php. Drupal already has the different node template (node-forum.tpl.php) built in.
If you suspect caching, clear the caches (admin -> site configuration -> performance), then visit admin -> site building -> themes -> your theme. This should make the system scan for template files again.
trying!
Thanks a lot, I'll try the module over the weekend since the code to hide the searchbox seems to be ignoring me :(
I'll let you know next week how are things going.
Perfect
Exactly what I was looking for. tahkns a lot ;)