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: 195,828
  • Total Topics: 21,286
  • Online today: 59
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 60
  • Total: 61
  • @rjen

Extended block access

Started by npereira, March 21, 2007, 06:43:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

npereira

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?

IchBin

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.


npereira

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

IchBin

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


npereira

ok, so if I want to use a custom action for board=2
there is 2 fields, what do I choose for the first?

IchBin

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.

npereira

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?

IchBin

If you want it to be in all the boards wouldn't you set it to forum then?

npereira

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

IchBin

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.

npereira

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

npereira

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');

?>

IchBin

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.

npereira

HAAA !    BINGO !  Thanks dude !

IchBin


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.
* IchBinâ„¢ crosses his fingers.

npereira

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"

npereira

hmmm... ok ... can you explain the code and what it does?

IchBin

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.

IchBin

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;
}

npereira

#19
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?

npereira

#20
Doesnt work in the topic or within a board... only in the forum.

IchBin

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.

npereira

Do you change anything in the custom part at the bottom?

IchBin

I didn't set any thing on the button options. I left them all set to nothing.

IchBin

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.

npereira

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?

IchBin

The code I gave you on page two already does this.

This website is proudly hosted on Crocweb Cloud Website Hosting.