Jump to content

Recommended Posts

Posted

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.

Posted (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 by Nathan Explosion
Posted
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"?

Posted (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 by Nathan Explosion
  • Recently Browsing   0 members

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