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

Recent

Welcome to TinyPortal. Please login or sign up.

May 05, 2024, 06:02:25 PM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,178
  • Total Topics: 21,220
  • Online today: 250
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 247
  • Total: 248
  • @rjen

[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.

Tanix

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