Link to first unread message in Display.template.php

Started by ChesterLM, April 01, 2010, 12:48:12 PM

Previous topic - Next topic

ChesterLM

I would like to have a link to the first unread post (if there is one) when viewing a topic. Something like 'View first unread post' just below the link tree. I'd like something that does the same as '$topic['new_href']' in MessageIndex.template.php.

I couldn't find a way to get the topic array in Display.template.php (to use "$topic['new_href']"), so I had a look at the contents of $context in Display.template.php, using
Code (php) Select
print '<pre>'; print_r($context); print '</pre>';
But I found nothing I could use to get such a link.

Can someone help me with this? I'm using SMF 1.1.11.

Arantor

If I remember rightly, it should be...


global $scripturl, $topic;
echo '<a href="', $scripturl, '?topic=', $topic, '.new#new'">View first unread post</a>';

ChesterLM

Thanks, that did it :)

My final implementation:
Code (php) Select
if ($context['user']['is_logged']){
echo '<a class=smalltext href="' , $scripturl , '?topic=' , $context['current_topic'] , '.new#new">View first unread post</a>';
}

Advertisement: