SimplePortal
Support => English Support => Topic started by: leonylyner on March 09, 2016, 03:46:19 AM
-
How to make use of Custom Display Option
to show a block in index.php?action=post;board=2.0
while not show in index.php?board=2.0
For example, a block that shows Tips when starting a new Topic in certain board.
Thanks!
-
I use this - only shows when I post in the board that is not negated.
In 'Display Options' > Advanced Options> Select Actions, Select Post.
Then in Custom Display Options:
-~topic,-~board|65,-~board|41,-~board|38,-~board|70,-~board|53,-~board|58
I did this ages ago so maybe there is a simpler way like just selecting the board, but then negating it on the board view. Then no need to negate all the others.
-
Thanks for the quick reply!
Also, is there a way to only show the block when Starting a Topic, but not show it if Replying to a Topic?
Thank you!
-
Only the first way seems to work so you need to negate all the boards you don't want it on.
I just tried selecting the board then negating the board index view but it did not work.
-
The first way can display a block when Replying but not display it when Starting a new topic, with -~topic.
But is it possible to reverse it?
Like, display a block when starting a new topic, but not display it when Replying?
Thanks a lot!
-
Also, is there a way to only show the block when Starting a Topic, but not show it if Replying to a Topic?
That is it - test it and you can see. It does not show on reply to topic. The reason is that topic appears in the action url so as it is negated it does not display.
Making a reply (because using -~topic it does not display):
hxxp://xxxxx.com/index.php?action=post;topic=3467.0;last_msg=15171
Making a new post (it will display):
hxxp://xxxxx.com/index.php?action=post;board=39.0
-
Oh, I get it now, thanks!
How about only show Block when Replying?
-
This documentation page is good - it was updated to make it easier to understand.
http://simpleportal.net/index.php?action=docs;area=custom_blocks_display
-
How about only show Block when Replying?
Try and work it out. Look at the links and see if you can use the options to make sure it only display for the reply url.
It can be done... I did not before myself.
This works in the Custom Display Options:
~last_msg
That stops it from showing when you post a new topic. Need to select the action to post and the board you want it in in the advanced options.
I thought using '-~board' would filter it out for the new topic as board occurs in the query string, but it doesn't work as it stops it in the reply as well.
-
Trying to display the block only new topic of a specific board.
but I can not.
?action=post;board=86.0
Attempts:
~action|post && ~board|86
~action|post && board|86
~action|post|board|86
~action=post|board=86
Anyone know if it's possible?
-
Try to display only on:
~board|86.0, ~action|post
-
Try to display only on:
~board|86.0, ~action|post
Does not work.
This way the block appears in posts, board and topics
And I need it to appear only on new topic to board 86
Would have to be something like:
~board|86.0 and ~action|post
-
I actually merged your topic with a previous one asking just about the same thing. However, I noticed that, unless I am horribly wrong, that what you ask is not quite possible because it would show somewhere else as well, in a way or another.
-
I was able to circumvent this limitation :D
Then in Custom Display Options:~board|86.0,-~topic
And ended the blockage in your PHP script
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'post')
<?php
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'post')
{
echo '<div class="alert alert-info fade in"><span style="font-size: 150%; line-height: 116%;">Se apresente respondendo as seguintes perguntas:</span><br /><br />
<img alt="Atençaõ" src="http://eletronicabr.com/images/dsystem/apontador1.gif" style="float: left;" />Preencha no campo <b>Assunto: Nome / Cidade / Estado</b>
<p><br />
1. Como você conheceu o EletrônicaBR? (ex: Google ou outro site)<br />
2. Qual seu nível técnico? (Amador, Estudante, Técnico, Engenheiro, Empresário)<br />
3. Quais habilidades você pretende desenvolver?<br />
4. Conte um pouco de você. Qualquer coisa.</p>
<b>Atenção!!!</b> Mensagens que não contenham os dados solicitados acima, Dúvidas ou Pedidos de Ajuda neste tópico serão apagados.
</div>';
};
?>
It would be interesting to implement this feature in the next version.
-
Thank you for posting that! :) I'll go ahead and mark this as solved then.
-
if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'post' || $_REQUEST['action'] == 'post2'))
^^ Covers some other cases.
Although it is shown also on editing a message.
Otherwise, if you want to be more flexible, you may be able to use some variables from SMF:
$context['is_new_topic']
$context['is_new_post']
$context['is_first_post']
TBH I'm not 100% sure they are already set when the block is prepared, but I guess it's worth a try.