Jump to content

Finding forum parent_id in global_templates


Recommended Posts

New to IPS..

What's the best way to get parent_id when landing on a specific forum (+ sub-forums and it's topics) using global_template?

Basically, I'm hard coding a menu item and I want to set it active when browsing within it's pages.

I know I can hardcode the forumids but some categories just have too many sub-forums. 


Link to comment
Share on other sites

It's depending on the site.
If you really mean the forum like https://invisioncommunity.com/forums/forum/505-product-guidance/ you can get it via \IPS\forums\Forum::load( \IPS\Request::i()->id )->parent()->_id ; 
If you need it when you're inside a topic, you can access it via \IPS\forums\Topic::load( \IPS\Request::i()->id )->container()->_id ;

So you'll need a construction which determines if you're viewing a forum or a topic and depending on this load the forum direct or the topic and then grab the forum data

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...