phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

How to make on click go to first unread post?


 
Search this topic... | Search General Support... | Search Box
Register or Login to Post    Index » General Support  Previous TopicPrint TopicNext Topic
Author Message
Sylver Cheetah 53
Board Member



Joined: 17 Dec 2008

Posts: 426
Location: Milky Way


flag
PostPosted: Mon Jan 05, 2009 10:07 pm 
Post subject: How to make on click go to first unread post?

Hy!

I'm having some troubles with Hypercells. It sais to do this (in viewforum_body.tpl):
Code:
#-----[ FIND ]------------------------------------------
#
     <td class="row1" width="100%"><span class="topictitle">{topicrow.NEWEST_POST_IMG}{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a></span><span class="gensmall"><br />
#
#-----[ REPLACE WITH ]-----------------------------
#
     <td class="row1" width="100%" onMouseOver="this.style.backgroundColor='{T_TD_COLOR1}'; this.style.cursor='pointer';" onMouseOut=this.style.backgroundColor="{T_TR_COLOR1}" onclick="window.location.href='{topicrow.U_VIEW_TOPIC}'"><span class="topictitle">{topicrow.NEWEST_POST_IMG}{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a></span><span class="gensmall"><br />

This is for subjects cells becoming hyperlinks. But I do not want them to be hyperlink to first post in the subject, but for first unread post. How can I do that? Please, help. icon_sad.gif

_________________
Image link
My Forum || My Blog

phpBB2 forever! icon_smile.gif
Back to top
drathbun
Board Member



Joined: 24 Jul 2008

Posts: 653
Location: Texas


flag
PostPosted: Tue Jan 06, 2009 6:03 am 
Post subject: Re: How to make on click go to first unread post?

Find the code in viewforum.php that assigns the link for the first unread post and copy it. icon_smile.gif

Cheetah you appear to have a lot of enthusiasm for your site and that's great. But you'll enjoy it a lot more if you try learning more about the code and start figuring things out for yourself. I know you've said you're not a programmer, but if you look at a few things they might start to make sense. For example, I look in viewforum.php and find the code that assigns the code to the orange (or green, if you're on this site) icon. That icon is what takes you to the first unread post, and it looks like this:
Code:
$newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';

Now if you know HTML, you know that <img src="..."> is an image link, and you won't need that. What you'll want is the newest post URL and that's embedded within that line of code:
Code:
'<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;view=newest") . '">

One of the little secrets of this link is that it doesn't know what the post ID is when the link is built; the ID for the first unread post is all determined by special code inside viewtopic. So all you need to do is create a URL that looks like this:
Code:
http://www.example.com/viewtopic.php?t=124289&view=newest

The code in viewtopic.php takes care of the rest. The code I posted above appears inside an "if" statement so the image is only available if there are, in fact, new posts.

_________________
phpBBDoctor Blog
Back to top
Sylver Cheetah 53
Board Member



Joined: 17 Dec 2008

Posts: 426
Location: Milky Way


flag
PostPosted: Tue Jan 06, 2009 12:01 pm 
Post subject: Re: How to make on click go to first unread post?

I've tryed this:
<td class="row1" width="100%" onMouseOver="this.style.backgroundColor='{T_TD_COLOR1}'; this.style.cursor='pointer';" onMouseOut=this.style.backgroundColor="{T_TR_COLOR1}" onclick="window.location.href='{topicrow.U_VIEW_TOPIC}'"><span class="topictitle">{topicrow.NEWEST_POST_IMG}{topicrow.TOPIC_TYPE}<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;view=newest") . '">{topicrow.TOPIC_TITLE}</a></span><span class="gensmall"><br />

Also, I've tryed this:
<td class="row1" width="100%" onMouseOver="this.style.backgroundColor='{T_TD_COLOR1}'; this.style.cursor='pointer';" onMouseOut=this.style.backgroundColor="{T_TR_COLOR1}" onclick="window.location.href='{topicrow.U_VIEW_TOPIC}'"><span class="topictitle">{topicrow.NEWEST_POST_IMG}{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}&view=newest" class="topictitle">{topicrow.TOPIC_TITLE}</a></span><span class="gensmall"><br />

It keeps getting me to the first post, and not the first unread. icon_sad.gif I'ved looked around the codes for the past one or two hours, and just couldn't make it to work.

_________________
Image link
My Forum || My Blog

phpBB2 forever! icon_smile.gif
Back to top
drathbun
Board Member



Joined: 24 Jul 2008

Posts: 653
Location: Texas


flag
PostPosted: Tue Jan 06, 2009 1:13 pm 
Post subject: Re: How to make on click go to first unread post?

You can't put the code directly into the template; the processing (building the link) has to go into the php file, and the resulting variable goes in the template file. Look in viewforum_body.tpl and find NEWEST_POST_IMG and you will see how the template change looks, and viewforum.php shows how the php code builds and fills that template variable.
_________________
phpBBDoctor Blog
Back to top
Display posts from previous:   
Register or Login to Post    Index » General Support  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0102 seconds using 15 queries. (SQL 0.0013 Parse 0.0002 Other 0.0087)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo