Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By rlarivee on
I am somewhat familiar with PHP and MYSQL, but I'm still new to Drupal. How can I display a particular block for a particular forum? I know how to display a block for forum pages in general by using the options on the edit block page. But this displays the same block for every forum page, regardless of forum topic. Is there a PHP snippet out there that will let me display a particular block for a particular forum topic?
Comments
Query String passes the node number to a Block
I found my own solution. The query string can be accessed within the block using the PHP code
echo $_GET['q'];
Once I have the string, it's just a matter of parsing it for the node number. Then lookup the forum number from term_node and use a case statement to switch the content from forum to forum.
Feel free to write that up
Feel free to write that up and add it to the php snippets section. I've seen others ask and not get it sorted out.
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide