TinyPortal

Development => Support => Topic started by: 7earitup on October 13, 2007, 12:07:05 PM

Title: One Center block on multiple forums.
Post by: 7earitup on October 13, 2007, 12:07:05 PM
How can I get one block to show on multiple specific forums? I would rather not have to make a center block for each of the forums.

If anyone knows how or can point me to a hack, it would be appreciated.
Title: Re: One Center block on multiple forums.
Post by: Zetan on October 13, 2007, 12:09:39 PM
This feature is to be added in TP 1.0
For now, there is a hack posted by IchBin. I don't know where exactly it is, so you'll need to search.
Title: Re: One Center block on multiple forums.
Post by: 7earitup on October 13, 2007, 12:19:57 PM
I am not having much luck looking for it. Any idea what to search for?
Title: Re: One Center block on multiple forums.
Post by: IchBin on October 13, 2007, 05:08:06 PM
Don't forget when you search you can choose a users posts that you want to search. I don't know where its at either so I would have to search for it as well. But I'll leave that up to you.
Title: Re: One Center block on multiple forums.
Post by: 7earitup on October 13, 2007, 09:09:13 PM
I found the post:
http://www.tinyportal.net/index.php?topic=14385.10

But I do not know how to combine the two snippets of code you had posted. I am completely new to PHP so I have no clue what breaks it and how to fix it when it does break.
Title: Re: One Center block on multiple forums.
Post by: tick on October 14, 2007, 12:17:33 AM
post your code here you want to use this with and I will try to help
Title: Re: One Center block on multiple forums.
Post by: 7earitup on October 14, 2007, 12:19:32 AM
Quote from: Tick� on October 14, 2007, 12:17:33 AM
post your code here you want to use this with and I will try to help

I basically just want to have a centered image in certain forums and child forums.
Title: Re: One Center block on multiple forums.
Post by: tick on October 14, 2007, 12:38:50 AM
ok post the code for the image and I will have a go at it.  I am not a coder by any means but I will see what I can do with it
Title: Re: One Center block on multiple forums.
Post by: 7earitup on October 14, 2007, 12:42:51 AM
Just something simple like this:

<div style="text-align: center;"><img width="134" height="100" src="/forums/tp-images/Image/bleach1.jpg" alt="" /></div>

Thanks a bunch buddy  ;D
Title: Re: One Center block on multiple forums.
Post by: tick on October 14, 2007, 12:45:46 AM
global $context;
if($context['current_action'] == '')
$current_action = 'home';
//$current_action = 'forum';
if (isset($_GET['board']) || isset($_GET['topic']))
$current_action = 'forum';
if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm', 'forum', 'tpadmin')))
$current_action = 'forum';
if($current_action == 'forum')
{
echo '<div style="text-align: center;"><img width="134" height="100" src="/forums/tp-images/Image/bleach1.jpg" alt="" /></div>';
}
else
{
return;
}
  Try this
Title: Re: One Center block on multiple forums.
Post by: 7earitup on October 14, 2007, 12:51:26 AM
Thanks a bunch, but what parts do I change in that to set it so the block only shows in certain forums?
Title: Re: One Center block on multiple forums.
Post by: tick on October 14, 2007, 12:53:04 AM
Well that code is supposed to do that. Is it now working. If not I will check it out
Title: Re: One Center block on multiple forums.
Post by: tick on October 14, 2007, 12:56:30 AM
ok i see now.  What boards are you wanting it to show up in.  I misread what the post said.  Get the board numbers that you want it to show up in and I will fix it.  To get those go to that board and look in the url and get the board number
Title: Re: One Center block on multiple forums.
Post by: 7earitup on October 14, 2007, 12:58:07 AM
25, 29, and 30 are the IDs for the boards.
Title: Re: One Center block on multiple forums.
Post by: tick on October 14, 2007, 01:10:08 AM
Try this one 
Quoteglobal $context;
if($context['current_board'] == 25,29,30)
{
echo '<div style="text-align: center;"><img width="134" height="100" src="/forums/tp-images/Image/bleach1.jpg" alt="" /></div>';
}

else
{
return;
}
IF not I will try again.  hehe  ;D
Title: Re: One Center block on multiple forums.
Post by: tick on October 14, 2007, 01:16:50 AM
I tried it it did not work.  Try it this way.global $context;
if($context['current_board'] == 25)
{
echo '<div style="text-align: center;"><img width="134" height="100" src="/forums/tp-images/Image/bleach1.jpg" alt="" /></div>';
}
elseif($context['current_board'] == 29)
{
echo '<div style="text-align: center;"><img width="134" height="100" src="/forums/tp-images/Image/bleach1.jpg" alt="" /></div>';
}
if($context['current_board'] == 30)
{
echo '<div style="text-align: center;"><img width="134" height="100" src="/forums/tp-images/Image/bleach1.jpg" alt="" /></div>';
}
else
{
return;
}
Title: Re: One Center block on multiple forums.
Post by: 7earitup on October 14, 2007, 01:25:24 AM
Ok - that works. But how can I keep it from showing the block's frame on other boards?
Title: Re: One Center block on multiple forums.
Post by: tick on October 14, 2007, 01:30:45 AM
Yeah I noticed that.  YOu will have to choose the option to not use frame or title.  Unless someone else comes along that knows a different way
Title: Re: One Center block on multiple forums.
Post by: 7earitup on October 14, 2007, 01:34:31 AM
Thanks for the information though. I should be able to find many uses for it. If anyone knows how to remove the frame, please let me know.
Title: Re: One Center block on multiple forums.
Post by: tick on October 14, 2007, 01:42:20 AM
Sure thing.  Glad to have helped ya.  Tick
Title: Re: One Center block on multiple forums.
Post by: IchBin on October 14, 2007, 04:40:14 AM
Good job Tick. For your info here's how you can use an array to check for multiple boards.
global $context;
$num = array(25,29,30);

if(array_intersect($num, $context['current_board']){
    echo 'stuff here for boards 25, 29, and 30';
}
Title: Re: One Center block on multiple forums.
Post by: tick on October 14, 2007, 04:43:28 AM
Thanks Ich.  I was trying to figure that out.  I will file that away in the ole noodle.   ;D
Title: Re: One Center block on multiple forums.
Post by: 7earitup on October 14, 2007, 04:44:27 AM
IchBinâ,,¢, any idea how to get rid of the table in forums where it shouldn't be?