TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 178
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 214
  • Total: 214

[Block] Only display "stuff" on certain boards

Started by Thurnok, January 27, 2007, 12:36:26 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Thurnok

Ok... this question has been asked a couple times, so I figured I would give you at least some sort of solution.  If you want to display a block (for example a center block) only on certain boards / subboards, here's a solution for you.

First, whether you have center blocks hidden from forum or not (via TinyPortal Settings page) this will work.  You should not display a title or frame for your block, otherwise, an empty block will show up on boards other than those you designate.


  • Create a php center block with the code found below.
  • Put the board numbers in the array for boards you want the content displayed on as the comment example shows.
  • Put your content in the area specified (remember, you need echo statements since it is a php block - replace the example ones with your own)
  • Select the option "Do not use title/frame" while editing the block.
  • Where it says "Show for this action", in the editbox to the far right put in: board
  • Do not select any of the pulldowns in that area!
Here's the block code "template" to use:

global $context;
// what board numbers to display on?
// example: array(3,7,9);
$disp_on_boards = array();

if (in_array($context['current_board'], $disp_on_boards)){
// your content here!
echo "This is only displayed on certain boards!<br />";
echo "Since you see this, you are obviously on one of those boards! ;) <br />";
}


Since it is necessary to not use a title/frame in order to completely hide the block from boards you don't want it displayed on, you may wish to create your own Title/Frame via HTML in your content that is only displayed where you wanted to start with.
Thurnok
The one, the only!

Tanix

Thank you very much! That's exactly what I needed, including not showing either title or frame.

This website is proudly hosted on Crocweb Cloud Website Hosting.