Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: Armada - kesäkuu 12, 2013, 10:41:21 AP

Otsikko: How to remove #new from 'latest topics' links?
Kirjoitti: Armada - kesäkuu 12, 2013, 10:41:21 AP
Hiya,

I'm using SSI.php to create a list of latest topics.

When I click on a new topic it takes me right to the end posting of that topic because the link has the #new at the end.

How do I get rid of that?

Thanks,
Armada
Otsikko: Re: How to remove #new from 'latest topics' links?
Kirjoitti: Kindred - kesäkuu 12, 2013, 12:56:41 IP
it doesn't take you to the end posting...  it takes you to the first post in the thread which is not marked as "read by you"
Otsikko: Re: How to remove #new from 'latest topics' links?
Kirjoitti: Colin - kesäkuu 12, 2013, 01:03:50 IP
You would need to modify SSI.php.
Otsikko: Re: How to remove #new from 'latest topics' links?
Kirjoitti: Ricky. - kesäkuu 12, 2013, 02:00:54 IP
you must be fetching latest post but not latest topics, if you fetch latest topics function then it should take you to latest topic only but not the latest post on that topic.

You should use :
ssi_boardNews($board = null, $limit = null, $start = null, $length = null, $output_method = 'echo')
Otsikko: Re: How to remove #new from 'latest topics' links?
Kirjoitti: Kindred - kesäkuu 12, 2013, 02:02:49 IP
boardnews?  no, I don't think so.  That fetches the entire post

ssi_recentTopics();

However...   recentTopics AND recentPosts both include the #new
Otsikko: Re: How to remove #new from 'latest topics' links?
Kirjoitti: Ricky. - kesäkuu 12, 2013, 04:34:13 IP
Guess, you are right,  wanted to mention recentTopics(), however from recent topic, if he takes it as array, then can create url without #new thing.
Otsikko: Re: How to remove #new from 'latest topics' links?
Kirjoitti: Armada - heinäkuu 30, 2013, 10:12:12 AP
Any help on this please?
Otsikko: Re: How to remove #new from 'latest topics' links?
Kirjoitti: emanuele - heinäkuu 30, 2013, 11:35:18 AP
Maybe knowing how you are using it would help quite a bit...
BTW I would do:
require_once('SSI.php');
$topics = ssi_recentTopics(WHATEVERYOUWANT, null, null, 'return');

foreach ($topics as $topic)
    echo '<a href="' . $scripturl . '?topic=' . $topic['topic'] . '.0'">' . $topic['subject'] . '</a>';
Otsikko: Re: How to remove #new from 'latest topics' links?
Kirjoitti: Armada - lokakuu 14, 2013, 09:25:33 AP
Thanks for the help.

In the end, it was pretty easy.

I opened SSI.php and looked for the function ssi_recentTopics();

I then searched for ;topicseen#new and removed it.

Et voila!  :)
Otsikko: Re: How to remove #new from 'latest topics' links?
Kirjoitti: Arantor - lokakuu 14, 2013, 09:26:11 AP
#new takes you to the first unread post in the topic... surely that's a good thing?
Otsikko: Re: How to remove #new from 'latest topics' links?
Kirjoitti: Armada - lokakuu 14, 2013, 09:34:37 AP
Yes, that's a brilliant thing if you want all users to jump to the very latest and last message of every post. I can see that's really useful for a list of latest replies,

I was asking how to remove this behaviour, because we're using it for a slightly different purpose - a list of latest active topics.

I prefer it so that users are taken to the top of the page to read some of the messages above it so that they could get the context of the latest reply. It saves having to scroll up each time.  :)

So, in reality it does become a list of "recent active Topics" rather than "recent replies". It also stops multiple replies on the same topic appearing on the list.

I suppose we all have our own preferences, and that makes things interesting.
Otsikko: Re: How to remove #new from 'latest topics' links?
Kirjoitti: Arantor - lokakuu 14, 2013, 09:43:50 AP
Lainaus käyttäjältä: Armada - lokakuu 14, 2013, 09:34:37 AP
Yes, that's a brilliant thing if you want all users to jump to the very latest and last message of every post. I can see that's really useful for a list of latest replies,

Except if you read my post, that IS NOT WHAT IT DOES.

The whole point of #new is to go to the first post in a topic you have not yet read. That may be the last post in the topic. It frequently isn't, though.

If you haven't read the last two messages in a topic, you don't get pushed to the last one, you get pushed to the last one you haven't seen yet.

In fact there is still a 1/15 chance it still won't do what you want either ;)
Otsikko: Re: How to remove #new from 'latest topics' links?
Kirjoitti: Armada - lokakuu 14, 2013, 10:48:09 AP
Yes, I did read your post, unfortunately it did not answer the question, it just explained what the behaviour of the #new was or what it did, and your reply was after I'd posted the solution myself, just in case it would help somebody.

It's not a critisism of the '#new' thing, chill, it's just I don't want it for the way we integrate the forum with our own pages.

Now we have a wonderful list that does the following:

1) It lists all the topics that have been most recently contributed to.
2) It does not duplicate the topics that has more than one reply.

When they click on a topic:
1) It takes people to the last page of the topic if there are multiple topics.
2) It takes people to the top of the page.

Perfect for us, 100%. :) It does exactly what I want now, thank you for your concern, it works like a charm.  :)
Otsikko: Re: How to remove #new from 'latest topics' links?
Kirjoitti: Arantor - lokakuu 14, 2013, 11:04:10 AP
LainaaWhen they click on a topic:
1) It takes people to the last page of the topic if there are multiple topics.
2) It takes people to the top of the page.

Except it doesn't necessarily do that, which is the point. If the link has a .new in it as well, it will go to whichever page the last unread will be on, which could just as easily be the previous page in a multipage topic.
Otsikko: Re: How to remove #new from 'latest topics' links?
Kirjoitti: Armada - lokakuu 14, 2013, 11:08:14 AP
Nope. To coin your own phrase, "If you'd read my last post" you would have seen:

Perfect for us, 100%. :) It does exactly what I want now, thank you for your concern, it works like a charm.  :)

Perfecto