Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted September 6, 20186 yr 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.
September 6, 20186 yr 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
Archived
This topic is now archived and is closed to further replies.