TinyPortal

Development => Support => Topic started by: npereira on March 21, 2007, 06:43:06 PM

Title: Extended block access
Post by: npereira on March 21, 2007, 06:43:06 PM
There is not muich instructions about this feature, the first one "Show for this action
(custom action name)"...

What are the different options for that specific setting?

I set a block as forum, but the block only shows up in the forum, I want it to show up everywhere in the forum but not in the main TP page.

How do I do this?
Title: Re: Extended block access
Post by: IchBin on March 21, 2007, 08:15:03 PM
custom action is exactly what is says, " A custom action". If you look at your address while you browse your forum you'll notice that each section of your site has a separate action associated with it, action=forum, action=profile, action=mlist etc. If you don't want it to show on the frontpage set the custom action to forum and it will only show when the url of your site has action=forum.

Title: Re: Extended block access
Post by: npereira on March 21, 2007, 08:19:15 PM
ok, but what if I want it to show everywhere BUT the TP main page?  I mean the forum, the boards and all...

BTW, i dont see actions when Im in the forum. I see index.php?topic= or board=

So could I put board=  and put more then 1 board?  something like board=all
Title: Re: Extended block access
Post by: IchBin on March 21, 2007, 08:23:36 PM
You'll either have to turn the sidepanel off then you're on the main page or custom code a block to only display in a certain area. You can't set any blocks to "not" display in TP "yet".

Title: Re: Extended block access
Post by: npereira on March 21, 2007, 09:36:23 PM
ok, so if I want to use a custom action for board=2
there is 2 fields, what do I choose for the first?
Title: Re: Extended block access
Post by: IchBin on March 21, 2007, 09:53:52 PM
You don't have to use a custom action to show it in the board=2. You can choose below which board you want it to display in.
Title: Re: Extended block access
Post by: npereira on March 21, 2007, 09:55:09 PM
ya, but I want to show it in all the board.
So this means I have to make a 1 block for each board I have?
Title: Re: Extended block access
Post by: IchBin on March 21, 2007, 09:56:39 PM
If you want it to be in all the boards wouldn't you set it to forum then?
Title: Re: Extended block access
Post by: npereira on March 21, 2007, 09:58:23 PM
I know, that's what im trying to do, but when I select forum, it only shows on the main forum, not when your inside a board.

The URL for forum is action=forum, but when your in a board, it's board=21.0
Title: Re: Extended block access
Post by: IchBin on March 21, 2007, 10:03:15 PM
Ah I see what you're saying. So you're trying to find away around the current "lack of" places to display your block. You can't do it "yet" with the options that are currently built into TP. But you could do it with a bit of code inside a phpbox. Let me take a few minutes and see if I can figure it out.
Title: Re: Extended block access
Post by: npereira on March 21, 2007, 10:05:05 PM
ok...Ã,  thanks

That's what I'm trying to figure out at this time, how to work the snippet codes inside a phpbox and I keep getting this error:

Parse error: syntax error, unexpected '<' in /public_html/Sources/Load.php(1749) : eval()'d code(35) : eval()'d code on line 1
Title: Re: Extended block access
Post by: npereira on March 21, 2007, 10:06:57 PM
This is a code I was just testing, and getting the above error:

<?php

ssi_boardNews($board = 6.0, $limit = 5, $start = null, $length = 250, $output_method = 'echo');

?>
Title: Re: Extended block access
Post by: IchBin on March 21, 2007, 10:25:22 PM
You do not need the <?php and ?> in your code, as TP already set them. I'm almost there with my code, I just can't figure out how to make it "not" display on the frontpage.
Title: Re: Extended block access
Post by: npereira on March 21, 2007, 10:26:43 PM
HAAA !    BINGO !  Thanks dude !
Title: Re: Extended block access
Post by: IchBin on March 21, 2007, 10:31:52 PM

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 'all your HTML goes here or PHP';
}
else
{
return;
}


Let me know if you need help putting your code in this.
This should show EVERYWHERE except on the frontpage. /me crosses his fingers.
Title: Re: Extended block access
Post by: npereira on March 21, 2007, 10:32:07 PM
Ya well, something is wrong because here is how I setup the above code as far as Custom Action:

Show for this action (custom action name): Forum , forum
Show when inside this board : TESTIN Forum
Show inside this TP section : none
Show when viewing this article : none
Show when viewing this category listing : none
Show for this language : none

The block still shows in the main forum "index.php?action=forum"
Title: Re: Extended block access
Post by: npereira on March 21, 2007, 10:33:52 PM
hmmm... ok ... can you explain the code and what it does?
Title: Re: Extended block access
Post by: IchBin on March 21, 2007, 10:36:52 PM
The code I posted checks to see where you are in the forum. If the action is equal to all the stuff in the array then $current_action is equal to forum. It also check to see if your url has "board" or "topic" in it.. if so, it sets $current_action is equal to forum again. If the there is no "current_action" it will only "return;", which is nothing.

Hence the if statement which says, if $current_action is equal to forum "echo all your stuff to the block", else echo nothing.
Title: Re: Extended block access
Post by: IchBin on March 21, 2007, 10:38:27 PM
So to use your code in my code it would look like this.
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')
{
ssi_boardNews($board = 6.0, $limit = 5, $start = null, $length = 250, $output_method = 'echo');
}
else
{
return;
}
Title: Re: Extended block access
Post by: npereira on March 21, 2007, 10:43:21 PM
Holy crap !Ã,  I gain about 1 month of knowledge in PHP in 1 post !Ã,   Dude you ROCK !

Next question, LOL

If I want to set it to specific boards? lets say board=5.0 and board=6.0Ã,   ...?

Also, do I have to do anything in the custom action section?
Title: Re: Extended block access
Post by: npereira on March 21, 2007, 11:25:27 PM
Doesnt work in the topic or within a board... only in the forum.
Title: Re: Extended block access
Post by: IchBin on March 22, 2007, 01:15:21 AM
I tested it on my forum it worked in topics and boards. If you'd like I can take a look for you. As for doing it in differnet boards, I'll have to look into that. Feel free to PM me if you want me to look at it.
Title: Re: Extended block access
Post by: npereira on March 22, 2007, 01:17:29 AM
Do you change anything in the custom part at the bottom?
Title: Re: Extended block access
Post by: IchBin on March 22, 2007, 01:40:23 AM
I didn't set any thing on the button options. I left them all set to nothing.
Title: Re: Extended block access
Post by: IchBin on March 22, 2007, 02:27:57 AM
Ok, found the array...


global $context;
if($context['current_board'] == 3)
{
echo 'stuff here';
}
elseif($context['current_board'] == 4)
{
echo 'stuff here';
}
else
{
return;
}


I'm sure you could combine this statement, but I'm am just code burned tonight sorry.
Title: Re: Extended block access
Post by: npereira on March 22, 2007, 05:12:54 PM
ok, so the box has to be phpbox. what other settings are needed to make this appear only in the boards and not the front page?
Title: Re: Extended block access
Post by: IchBin on March 22, 2007, 07:07:24 PM
The code I gave you on page two already does this.