princeton Posted September 6, 2018 Posted September 6, 2018 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. Thanks.
Fosters Posted September 6, 2018 Posted September 6, 2018 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
Recommended Posts
Archived
This topic is now archived and is closed to further replies.