Show something everywhere except on board index?

Started by MarkoKg, September 24, 2016, 08:43:35 AM

Previous topic - Next topic

MarkoKg

Hey there.

I want to add something, for example banners on all pages under the header except on front page (board index). How can I do that? I need code to be added in Index.template.php but I'm not sure if there's something like 'if curenturl is not equal to boardindexurl" statement or something similar.

Thanks!

Kindred

not certain... but I think this would work

if (empty($context['current_action']))
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

if (empty($context['current_action']) && empty($topic) && empty($board))

Just make sure everything is in scope before trying to check them.

MarkoKg

Just tried this, but it's not working though.


if (empty($context['current_action']) && empty($topic) && empty($board))
{
echo'banner code here';
}
echo'


$context is already in globals, just checked that. Not sure what I'm doing wrong.  :-X

Arantor

Did you add topic and board to globals for that function?

And when you say 'not working', define 'not working', I can think of a multitude of different ways that 'not working' could play out depending on what you're doing, where and how.

MarkoKg

Yes, topic and board are also in globals for that function, i just double-checked.

When I add the code that I wrote in previous message the banner is showing on boardIndex, and not showing on all other pages/boards/topics. What I need is vice versal - to show on all other pages and to hide it on board index.

EDIT: Gotcha, thanks!
I used:

if (empty($context['current_action']) && empty($topic) && empty($board))
{
echo'something that should be shown on board index';
}
else {
echo' banner HTML code here ';
}

Paracelsus

Have you tried switching the instructions? The content on first echo switches with the content on else echo. ;)

Edit: ok, too late, I see you already got it. ;D

Advertisement: