Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Lucas Thompson Posted May 21, 2022 Posted May 21, 2022 How can I create a unique sidebar html block or widget for each sidebar? I want to add unique content into the sidebar for each club. Also, the current forum in my club doesn't have a sidebar at all. How do I add the sidebar? Thank you.
Lucas Thompson Posted May 21, 2022 Author Posted May 21, 2022 Just now, Adriano Faria said: You can’t. Is it possible with custom coding? Is custom coding something that can be done with invision communities forums?
Adriano Faria Posted May 21, 2022 Posted May 21, 2022 Just now, Lucas Thompson said: Is it possible with custom coding? Is custom coding something that can be done with invision communities forums? Yes and yes.
Lucas Thompson Posted May 21, 2022 Author Posted May 21, 2022 2 minutes ago, Nathan Explosion said: Got Pages? What do you mean? Can you put a club in a page somehow so I can have a unique sidebar for each club? Thanks
Nathan Explosion Posted May 21, 2022 Posted May 21, 2022 (edited) Do you have the 'Pages' app? If so, create a custom block (with a custom template) which detects the Club ID and then presents your unique content. Then drag the block in place in Clubs. Edited May 21, 2022 by Nathan Explosion
Lucas Thompson Posted May 22, 2022 Author Posted May 22, 2022 9 hours ago, Nathan Explosion said: Do you have the 'Pages' app? If so, create a custom block (with a custom template) which detects the Club ID and then presents your unique content. Then drag the block in place in Clubs. Thanks, but how do you make the custom block "detect the club id and then presents your unique content"?
Nathan Explosion Posted May 22, 2022 Posted May 22, 2022 (edited) This would be for the Club's 'homepage', using 'Manual HTML' for the Content Editor: {{if \IPS\Request::i()->id == '5'}} Unique content for Club with ID 5 {{elseif \IPS\Request::i()->id == '6'}} Unique content for Club with ID 6 {{endif}} This would be for the Club's topic listing, using 'Manual HTML' for the Content Editor: {{$forum = \IPS\forums\Forum::load(\IPS\Request::i()->id);}} {{$clubId = $forum->club()->id;}} {{if $clubId == '5'}} Unique content for Club with ID 5 {{elseif $clubId == '6'}} Unique content for Club with ID 6 {{endif}} This would be for the Club's topic view, using 'Manual HTML' for the Content Editor: {{$topic = \IPS\forums\Topic::load(\IPS\Request::i()->id);}} {{$clubId = $topic->container()->club()->id;}} {{if $clubId == '5'}} Unique content for Club with ID 5 {{elseif $clubId == '6'}} Unique content for Club with ID 6 {{endif}} Do not enable the 'Cache this block' setting Edited May 22, 2022 by Nathan Explosion
Recommended Posts