Change header depending if inbox is on inbox or sent page

Started by samborabora, July 27, 2014, 01:53:07 PM

Previous topic - Next topic

samborabora

I'd like to display a different header on my pm pages, if the current page is either received or sent personal messages, like so:

if (!empty($context['current_action']))
{
if ($context['current_action'] == 'pm')
echo '<a href="index.php?action=pm;f=sent"><div id="inboxselected"></div></a>';
elseif ($context['current_action'] == '???????')
echo '<a href="index.php?action=pm"><div id="inboxseent"></div></a>';
}


I have put ??????? in the part that I'm not sure what to put for the action "?action=pm;f=sent". As you can see, if the current action is "index.php?action=pm", then show a link to "index.php?action=pm;f=sent" and if the current page is "index.php?action=pm;f=sent" then show a link for "index.php?action=pm". Trouble is, the first bit can't just be "pm" as it needs to check if it HASN'T got a subaction of "f=sent" and the other page needs to check if it HAS got the subaction of ";f=sent" and I'm not too sure how to work with subactions. Any ideas? :D

samborabora

I think for what I need, this might work:

if ($context['folder'] !== 'sent')
echo '<a href="index.php?action=pm;f=sent"><div id="inboxselected"></div></a>';
elseif ($context['folder'] == 'sent')
echo '<a href="index.php?action=pm"><div id="inboxseent"></div></a>';


Hope it's useful for anyone else, and hopefully it won't fail on other pages :P

Advertisement: