Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: live627 on July 08, 2008, 07:15:38 PM

Title: AJAX Recent Topics
Post by: live627 on July 08, 2008, 07:15:38 PM
[Link to the mod](https://custom.simplemachines.org/index.php?mod=1284)

## AJAX Recent Topics
[![MIT license](http://img.shields.io/badge/license-MIT-009999.svg)](http://opensource.org/licenses/MIT)
[![Crowdin](https://badges.crowdin.net/custom-form/localized.svg)](https://crowdin.com/project/custom-form)
[![Latest Version](https://img.shields.io/github/release/live627/smf-ajax-recent-topics.svg)](https://github.com/live627/smf-ajax-recent-topics/releases)
[![Support](http://img.shields.io/badge/PayPal-$-009966.svg)](https://www.paypal.me/JohnRayes)

Package name | SMF version | Minimmum PHP version
--- | --- | ---
[AJAX Recent Topics 2.0.1](https://github.com/live627/smf-ajax-recent-topics/releases/download/v2.0.1/ajax-recent-topics_2-0-1.tgz) | SMF 2.0.x, SMF 2.1.x | PHP 7.1
AJAX Recent Topics 1.0.1 | SMF 1.1.x, 2.0 RC2 | PHP 4.3

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/A0A8GEKTO)

[View changelog](https://github.com/live627/smf-ajax-recent-topics/blob/master/CHANGELOG.md)

### Overview

This mod adds a Recent Topics list that is updated via AJAX to your board. It can be found at ?action=recenttopics

- Setup this mod at Administration Center » Configuration » Modifiations.
- Optional menu button located to the right of Search
- Control how often to check for new topics.
   - Defaults to ten (10) seconds.
   - Too fast of an interval increases the server load.

Developed by live627 and created by SlammedDime.
Title: Re: AJAX Recent Topics
Post by: Qayyom Ashraf on July 09, 2008, 01:23:54 AM
Any Live / working DEMO? or Screen shots

Please
Title: Re: AJAX Recent Topics
Post by: SlammedDime on July 09, 2008, 03:49:35 AM
This isn't my site, or my mod, but the functionality is identical

http://mycoffeelounge.net/forum-recent.php
Title: Re: AJAX Recent Topics
Post by: Alpay on July 09, 2008, 03:55:18 AM
Dear SlammedDime 
I would like permission to translate your mod, AJAX Recent Topics into Turkish. If you accept, I also want to kindly ask you to release it in the mod site, so that I won't be violating any redistribution rules via redistibuting the mod myself. Thank you in advance.

Quote$txt['recent_topics'] = 'Son Konular';
$txt['minutes_ago'] = ' Dakika önce';
$txt['number_recent_topics_interval'] = 'Güncellenmiş konular için kontrol edilicek (saniye cinsinden) bekleme süresi';
$txt['number_recent_topics_interval_desc'] = '5-10 sn kabul edilebilir,çok düşük değil.';
$txt['number_recent_topics'] = 'Son konular sayfasın da gösterilicek konu sayısı';

Best Regards,
Alpay

Edit :
SlammedDime ; you're welcome,if one or two words will been updated,I'll contact u with pm,nice days
Title: Re: AJAX Recent Topics
Post by: SlammedDime on July 09, 2008, 03:56:50 AM
If you don't mind, I'll kindly add the information to the first post of this topic.  Thanks for the translation!
Title: Re: AJAX Recent Topics
Post by: stanaca on July 09, 2008, 04:18:57 AM
Great mod.............
Title: Re: AJAX Recent Topics
Post by: digit on July 09, 2008, 04:27:27 AM
Wow!  Very cool!  Thanks!  (>I< have a new default page!)

Does this increase server load in any way?

hmm, small issue... I have noticed that even though a post was made about 10 minutes ago - it's still showing 0 minutes ago... even after new posts have updated the page.  If I manually reload the page - the times ARE updated
Title: Re: AJAX Recent Topics
Post by: stanaca on July 09, 2008, 05:43:02 AM
You can use this link as demo but my site is slow in case of posts so page may not update.


Demo:
http://www.stanaca.com/index.php?action=recenttopics
Title: Re: AJAX Recent Topics
Post by: digit on July 09, 2008, 05:48:27 AM
Let me know when you create the AJAX who's online list!   ;)
Title: Re: AJAX Recent Topics
Post by: SlammedDime on July 09, 2008, 09:54:49 AM
The times will not update automatically.  That would be far too much javascript work.

As for server load: it's less server load than someone pushing F5 to refresh the page.
Title: Re: AJAX Recent Topics
Post by: jossanaijr on July 09, 2008, 10:32:14 AM
Sorry but what exactly does this MOD do?
Title: Re: AJAX Recent Topics
Post by: Minare on July 09, 2008, 12:18:57 PM
Thank u for the mod

I am using here  (http://www.minare.net/forum/index.php?action=recenttopics) and I want to ask sth, can we set how many topics will be displayed ?

If yes, how ?

I couldn find any settings in admin

Thanks again
Title: Re: AJAX Recent Topics
Post by: p.goepfert on July 09, 2008, 04:59:04 PM
I translated it to German - not very professional, but a nativ Speaker understands :)

<file name="$languagedir/Modifications.german.php">
<operation>
<search position="after"><![CDATA[?>]]></search>
<add><![CDATA[// AJAX Recent Topics
$txt['recent_topics'] = 'Neueste Themen';
$txt['minutes_ago'] = ' Minuten her';
$txt['number_recent_topics_interval'] = 'Zeit (in Sekunden) zwischen Update-Check nach neuen Beiträgen';
$txt['number_recent_topics_interval_desc'] = 'Nicht zu niedrig wählen, 5-10 Sekunden sind vernünftig';
$txt['number_recent_topics'] = 'Anzahl der anzuzeigenden Themen auf der Neueste-Themen-Seite';

]]></add>
</operation>
</file>
Title: Re: AJAX Recent Topics
Post by: SlammedDime on July 09, 2008, 06:13:24 PM
jossanaijr - Look at the link in the example in the post below yours, as well as the example I posted in my second post in the topic, should be explanatory.

منارة - Settings can be found in Current Theme settings in your Admin panel.  You can set the number of topics and the refresh rate.  Default is 50 and 10 seconds, respectively.

Thank you pago.
Title: Re: AJAX Recent Topics
Post by: jossanaijr on July 09, 2008, 06:28:21 PM
Quote from: SlammedDime on July 09, 2008, 06:13:24 PM
jossanaijr - Look at the link in the example in the post below yours, as well as the example I posted in my second post in the topic, should be explanatory.
Because I have this (image attached) in my forum.  Besides the layout and the information a little different what is the advantage of this MOD?  :-[
Title: Re: AJAX Recent Topics
Post by: SlammedDime on July 09, 2008, 06:36:17 PM
I don't know what exactly you have, but this updates topics on the page in real time, no refresh needed.
Title: Re: AJAX Recent Topics
Post by: jossanaijr on July 09, 2008, 06:38:33 PM
OK, thanks.
Title: Re: AJAX Recent Topics
Post by: Paracelsus on July 10, 2008, 02:44:58 AM
2 thumbs up, I was waiting for this Mod ;)


A few questions:

1. How to change that gray color of the new listed topics?

2. Would it be possible to config this feature as "post-centered" instead of "topic-centered"? (see the attached example)
Title: Re: AJAX Recent Topics
Post by: SlammedDime on July 10, 2008, 02:52:57 AM
1) It uses the classes windowbg and windowbg2 of your style.css, so whichever colors you have set for those, thats what it uses.

2) Are you talking about showing the contents, or part of it, from the post as well?  The only problem I forsee with this is bbcode, and throwing the layout out of line.  I suppose I could strip all bbcode and image tags and html tags out, so its just plain text though.
Title: Re: AJAX Recent Topics
Post by: Paracelsus on July 10, 2008, 09:11:26 AM
Quote from: SlammedDime on July 10, 2008, 02:52:57 AM
1) It uses the classes windowbg and windowbg2 of your style.css, so whichever colors you have set for those, thats what it uses.

2) Are you talking about showing the contents, or part of it, from the post as well?  The only problem I forsee with this is bbcode, and throwing the layout out of line.  I suppose I could strip all bbcode and image tags and html tags out, so its just plain text though.

1) Got it ;) and 2) Yes, that was my point (a little content preview).


An issue:

- The message time isn't updated correctly - If you don't refresh the recent topics page, the "xx minutes ago" thing doesn't update itself (except for the new topics that popup). Eventually, you'll have a full page with "0 minutes ago". (I know this because I've changed the target of "new post" link to a new window)
Title: Re: AJAX Recent Topics
Post by: SlammedDime on July 10, 2008, 10:05:43 AM
Quote from: SlammedDime on July 09, 2008, 09:54:49 AM
The times will not update automatically.  That would be far too much javascript work.

As for server load: it's less server load than someone pushing F5 to refresh the page.

I already touched on that up here.  I will look at making that change though.
Title: Re: AJAX Recent Topics
Post by: digit on July 13, 2008, 05:29:52 AM
I am not sure if it's just something to do with my server or?

It seems that it's taking longer and longer to load this ajax enabled recent topics page. 

Am I alone?
Title: Re: AJAX Recent Topics
Post by: SlammedDime on July 13, 2008, 02:55:11 PM
Perhaps your site isn't as busy as you would like?  Link?
Title: Re: AJAX Recent Topics
Post by: digit on July 13, 2008, 03:08:17 PM
My site's VERY busy - it updates every minute or so (works GREAT!) :)   I mean, it seems to take longer and longer just to access the url.  I have PM'd you the URL.

When testing it at....  http://www.websitepulse.com/ my forum's base URL responds in under a second. 

The ajax enabled recent topics URL takes over 7 seconds - but when I first installed it, it responded in just about 2 seconds.

I'm concerned it's straining the server somehow.


Title: Re: AJAX Recent Topics
Post by: SlammedDime on July 13, 2008, 03:26:00 PM
That website is a little inaccurate, at least from where I'm at.  The ajax requests are only taking on average around 1.5 seconds, which isn't too bad, but it may be creating some server strain on mysql because of the size of your messages table, but this could possibly be alleviated...
Try running this query on the messages table in the database:

ALTER TABLE `[YOUR DB PREFIX]_messages` ADD INDEX `last_post_time` ( `posterTime` ) 
Title: Re: AJAX Recent Topics
Post by: digit on July 13, 2008, 03:32:17 PM
Quote from: SlammedDime on July 13, 2008, 03:26:00 PM
That website is a little inaccurate, at least from where I'm at.  The ajax requests are only taking on average around 1.5 seconds, which isn't too bad, but it may be creating some server strain on mysql because of the size of your messages table, but this could possibly be alleviated...
Try running this query on the messages table in the database:

ALTER TABLE `[YOUR DB PREFIX]_messages` ADD INDEX `last_post_time` ( `posterTime` ) 

Thanks I'll try that.... I'll have to do that a bit later during off peak hours - need to do a backup first.

What will that do?

Thanks!
Title: Re: AJAX Recent Topics
Post by: SlammedDime on July 13, 2008, 03:36:05 PM
All it does is add an index to the table to make lookups on certain fields faster.  Since this mod relys on the posterTime field in the messages table, without an index, the query starts from the beginning of the table and goes to the end.  This should significantly increase the query speed, allowing mysql to jump straight to the end of the table to start its query.  No need to really do a backup (always a good idea anyway), as this doesn't alter any data in the table itself.

If this works for you (please let me know when you've done it so I can take a look at your site again), I'll include it in the next release for Beta 4. :)
Title: Re: AJAX Recent Topics
Post by: digit on July 13, 2008, 03:44:29 PM
Hmm...  for some reason, it's hanging when I try to run that command....

I also noticed some warnings about that table...

UNIQUE and INDEX keys should not both be set for column `ID_TOPIC`
UNIQUE and INDEX keys should not both be set for column `ID_MEMBER`
More than one INDEX key was created for column `ID_MEMBER`

Is this normal?

EDIT: seems that SQL query eventually worked! Will report back.

Title: Re: AJAX Recent Topics
Post by: digit on July 13, 2008, 03:53:50 PM
After testing it - base forum responds in less than a second, recent topics page is responding in 5-6 seconds - so it is a little bit faster!  :D
Title: Re: AJAX Recent Topics
Post by: SlammedDime on July 13, 2008, 04:12:46 PM
Well the AJAX requests are definately much much faster... only 97 milliseconds, compared with 1.5-2 second averages from before, so the AJAX part is much better.  As for initial page load, I'll take a look at the query and see if there's a way I can speed it up some.  I can't promise much, but I'll see what I can do.


And just to clarify, that site you're using to test is only testing initial page loads.  So while it reports 6-7 second load times, thats only for the initial page load, that is not for the AJAX requests.  I'm only getting 4-5 second page loads from my end.

Edit: After looking at the indexes on the topics and messages table, I'm sure I can increase the performance of the query.  I'll use you as my test guinea pig if you don't mind.... :)  Don't worry, I won't break your forum.
Title: Re: AJAX Recent Topics
Post by: digit on July 13, 2008, 04:19:31 PM
Quote from: SlammedDime on July 13, 2008, 04:12:46 PM
I'll use you as my test guinea pig if you don't mind.... :) 

Test away!   :D

I'll be waiting for that ajax who's online list too!  ;)  lol
Title: Re: AJAX Recent Topics
Post by: SlammedDime on July 13, 2008, 04:44:56 PM
Quote from: digit on July 13, 2008, 04:19:31 PM
Quote from: SlammedDime on July 13, 2008, 04:12:46 PM
I'll use you as my test guinea pig if you don't mind.... :) 

Test away!   :D

I'll be waiting for that ajax who's online list too!  ;)  lol
;)

I'll mess around with the query when I get home from work tonight.  :)
Title: Re: AJAX Recent Topics
Post by: SlammedDime on July 14, 2008, 05:20:58 AM
Okay digit, give this a shot

Open Sources/Recent.php, in the function RecentTopics()

Code (Find) Select
$latest_post = !empty($_REQUEST['latest']) ? 'AND m.PosterTime > ' . (int) $_REQUEST['latest'] : '';

$context['topics'] = array();
// Find all the posts in distinct topics.  Newer ones will have higher IDs.
$request = db_query("
SELECT
ms.posterTime as firstTime, m.posterTime as lastTime, ms.subject, m.ID_TOPIC, t.numReplies,
ms.ID_MEMBER as ID_FIRST_POSTER, m.ID_MEMBER as ID_LAST_POSTER, m.ID_MSG, b.ID_BOARD, b.name AS bName,
IFNULL(mem2.realName, ms.posterName) AS firstPoster,
IFNULL(mem.realName, m.posterName) AS lastPoster
FROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}messages AS ms)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
LEFT JOIN {$db_prefix}members AS mem2 ON (mem2.ID_MEMBER = t.ID_MEMBER_STARTED)
WHERE t.ID_LAST_MSG = m.ID_MSG
AND b.ID_BOARD = t.ID_BOARD
AND $query_this_board
AND ms.ID_MSG = t.ID_FIRST_MSG
$latest_post
ORDER BY t.ID_LAST_MSG DESC
LIMIT " . $settings['number_recent_topics'], __FILE__, __LINE__);


and

Code (Replace) Select
$latest_post = !empty($_REQUEST['latest']) ? 'AND m.PosterTime > ' . (int) $_REQUEST['latest'] : '';

$min_message_id = $modSettings['maxMsgID'] - (int) (($modSettings['totalMessages'] / $modSettings['totalTopics']) * $settings['number_recent_topics']);

$context['topics'] = array();
// Find all the posts in distinct topics.  Newer ones will have higher IDs.
$request = db_query("
SELECT
ms.posterTime as firstTime, m.posterTime as lastTime, ms.subject, m.ID_TOPIC, t.numReplies,
ms.ID_MEMBER as ID_FIRST_POSTER, m.ID_MEMBER as ID_LAST_POSTER, m.ID_MSG, b.ID_BOARD, b.name AS bName,
IFNULL(mem2.realName, ms.posterName) AS firstPoster,
IFNULL(mem.realName, m.posterName) AS lastPoster
FROM {$db_prefix}topics AS t
INNER JOIN {$db_prefix}messages AS m ON (m.id_msg = t.id_last_msg)
INNER JOIN {$db_prefix}boards AS b ON (b.id_board = t.id_board)
INNER JOIN {$db_prefix}messages AS ms ON (ms.id_msg = t.id_first_msg)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
LEFT JOIN {$db_prefix}members AS mem2 ON (mem2.ID_MEMBER = t.ID_MEMBER_STARTED)
WHERE t.ID_LAST_MSG >= $min_message_id
AND $query_this_board
$latest_post
ORDER BY t.ID_LAST_MSG DESC
LIMIT " . $settings['number_recent_topics'], __FILE__, __LINE__);


See what that does for you.
Title: Re: AJAX Recent Topics
Post by: digit on July 14, 2008, 10:32:05 AM
Quote from: SlammedDime on July 14, 2008, 05:20:58 AM
Okay digit, give this a shot

Open Sources/Recent.php, in the function RecentTopics()

[snip]

See what that does for you.

BAM!  Lightning fast!   :D  Thanks!
Title: Re: AJAX Recent Topics
Post by: digit on July 15, 2008, 05:28:33 PM
Slight problem.

It seems that by clicking on the last post icon, I am not actually getting the last post.

It links to a post like...

http://www.mysite.com/index.php/topic,168956.new/topicseen.html#new

When the last post is more like....

http://www.mysite.com/index.php/topic,168956.msg1230733.html#msg1230733

Thanks if you can fix that, and thanks again for fixing the speed issue.



Title: Re: AJAX Recent Topics
Post by: SlammedDime on July 16, 2008, 04:21:41 AM
It should be taking you to the newest post.  SMF has a feature whereas if you put .new in there, like I have, Display.php does an extra query to figure out what the newest post is for the current user and directs them to it upon page load.  I'll look into this a bit further and get back to you.
Title: Re: AJAX Recent Topics
Post by: thomas86 on July 18, 2008, 04:16:02 AM
Hello,

This mod is geat, but i thnik how i make to display this Recent Post Instead of Default Recent Post on Home Page Board...

I Think thats I should edit board.index.template on Themes/default ... but when I edit this file The Recent Post was displayed on Home Page but it isn't Displayed nofing on table were should displaed post ...
I past this code on home page...
echo '
<div class="tborder" ', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'style="width: 100%;"' : '', '>
<table border="0" width="100%" cellspacing="0" cellpadding="4" class="bordercolor" id="topicTable">
<tr>';

// Are there actually any topics to show?
echo '
<td width="15%" class="catbg3"><strong>', $txt['smf82'], '</strong></td>
<td class="catbg3"><strong>', $txt[118], '</strong></td>
<td width="50" class="catbg3" align="center"><strong>', $txt[110], '</strong></td>
<td width="150" class="catbg3" align="center"><strong>', $txt[109], '</strong></td>
<td width="150" class="catbg3" align="center"><strong>', $txt[22], '</strong></td>
<td width="16" class="catbg3"></td>';

// No topics.... just say, "sorry bub".
if (empty($context['topics']))
echo '
</tr>
<tr id="no_topics">
<td class="windowbg2" width="100%" colspan="6"><strong>', $txt[151], '</strong></td>';

echo '
</tr>';

foreach ($context['topics'] as $topic)
{
echo '
<tr class="windowbg2" id="topic_', $topic['id'], '">
<td class="smalltext" style="padding-left: 10px; border-bottom: 1px solid rgb(204, 204, 204);">', $topic['board']['link'], '</td>
<td style="padding-left: 10px; border-bottom: 1px solid rgb(204, 204, 204);">', $topic['link'], '</td>
<td align="center" class="smalltext" style="border-bottom: 1px solid rgb(204, 204, 204);">', $topic['replies'], '</td>
<td align="center" class="smalltext" style="border-bottom: 1px solid rgb(204, 204, 204);">', $topic['firstPoster']['link'], '<br />', $topic['firstPoster']['time'], '</td>
<td align="center" class="smalltext" style="border-bottom: 1px solid rgb(204, 204, 204);">', $topic['lastPoster']['link'], '<br />', $topic['lastPoster']['time'], '</td>
<td align="center" style="border-bottom: 1px solid rgb(204, 204, 204);"><a href="', $topic['lastPost']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt[111], '" title="', $txt[111], '" /></a></td>
</tr>';
}

echo '
</table>
</div>';

// Now for all of the javascript stuff
echo '
<script language="Javascript" type="text/javascript"><!-- // -->
var last_post = ', (!empty($context['last_post_time']) ? $context['last_post_time'] : 0), ';
var time_interval = ', $settings['number_recent_topics_interval'] * 1000, ';
var max_topics = ', $settings['number_recent_topics'], ';

var interval_id = setInterval( "getTopics()", time_interval);

function getTopics()
{
if (window.XMLHttpRequest)
getXMLDocument("', $scripturl, '?action=recenttopics;latest=" + last_post + ";xml", gotTopics);
else
clearInterval(interval_id);
}

function gotTopics(XMLDoc)
{
var updated_time = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("lastTime")[0];
var topics = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("topic");
var topic, id_topic, board, subject, replies, firstPost, lastPost, link;
var myTable = document.getElementById("topicTable"), oldRow, myRow, myCell, myData, rowCount;

// If this exists, we have at least one updated/new topic
if (updated_time)
{
// Update the last post time
last_post = updated_time.childNodes[0].nodeValue;

// No Messages message?  Ditch it!
// Note, this should only happen if there are literally zero topics
// on the board when a user visits this page.
if (document.getElementById("no_topics") != null)
myTable.deleteRow(-1);

// If the topic is already in the list, remove it
for (var i = 0; i < topics.length; i++)
{
topic = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("topic")[i];
id_topic = topic.getElementsByTagName("id")[0].childNodes[0].nodeValue;
if ((oldRow = document.getElementById("topic_" + id_topic)) != null)
myTable.deleteRow(oldRow.rowIndex);
}

// Are we going to exceed the maximum topic count allowed?
while (((myTable.rows.length - 1 + topics.length) - max_topics) > 0)
myTable.deleteRow(-1);

// Now start the insertion
for (var i = 0; i < topics.length; i++)
{
// Lets get all of our data
topic = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("topic")[i];
id_topic = topic.getElementsByTagName("id")[0].childNodes[0].nodeValue;
board = topic.getElementsByTagName("board")[0].childNodes[0].nodeValue;
subject = topic.getElementsByTagName("subject")[0].childNodes[0].nodeValue;
replies = topic.getElementsByTagName("replies")[0].childNodes[0].nodeValue;
firstPost = topic.getElementsByTagName("first")[0].childNodes[0].nodeValue;
lastPost = topic.getElementsByTagName("last")[0].childNodes[0].nodeValue;
link = topic.getElementsByTagName("lastLink")[0].childNodes[0].nodeValue;

// Now to create the new row...
myRow = myTable.insertRow(1);
myRow.id = "topic_" + id_topic;
myRow.className = "windowbg";

// First the Board
myCell = myRow.insertCell(-1);
myCell.className = "smalltext";
myCell.style.paddingLeft = "10px";
myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
setInnerHTML(myCell, board);

// Then subject
myCell = myRow.insertCell(-1);
myCell.style.paddingLeft = "10px";
myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
setInnerHTML(myCell, subject);

// replies
myCell = myRow.insertCell(-1);
myCell.className = "smalltext";
myCell.align = "center"
myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
setInnerHTML(myCell, replies);

// first post
myCell = myRow.insertCell(-1);
myCell.className = "smalltext";
myCell.align = "center"
myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
setInnerHTML(myCell, firstPost);

// last post
myCell = myRow.insertCell(-1);
myCell.className = "smalltext";
myCell.align = "center"
myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
setInnerHTML(myCell, lastPost);

// last post
myCell = myRow.insertCell(-1);
myCell.align = "center"
myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
setInnerHTML(myCell, link);
}
}
}
// ]]></script>';

...
When I refresh page there are nothing on recent post ... and after few minuts the recent post is displayed ...

I think why the recent post isn't display "at now" after i refresh page...
And on end my post I would like say "sorry" for my poor english...


I'll Thankful for help,
Regards,
Thomas
Title: Re: AJAX Recent Topics
Post by: SlammedDime on July 18, 2008, 05:23:44 AM
You would need to add code to BoardIndex.php in the Sources directory to perform the SQL query.  You'd have to copy the SQL part of the RecentTopics() function from Recent.php and you should be able to get something to work.
Title: Re: AJAX Recent Topics
Post by: digit on July 18, 2008, 08:03:28 AM
Quote from: SlammedDime on July 16, 2008, 04:21:41 AM
It should be taking you to the newest post.  SMF has a feature whereas if you put .new in there, like I have, Display.php does an extra query to figure out what the newest post is for the current user and directs them to it upon page load.  I'll look into this a bit further and get back to you.

Well, this may be more of a browser issue - (Safari on a Mac) I seem to have the same problem here at smf.... so ignore that.

On another note:  How would I restrict access to the Ajax Recent results to my Charter Members only (group ID 9)... 'any easy way to do it?

Thanks!
Title: Re: AJAX Recent Topics
Post by: thomas86 on July 18, 2008, 03:38:58 PM
Quote from: SlammedDime on July 18, 2008, 05:23:44 AM
You would need to add code to BoardIndex.php in the Sources directory to perform the SQL query.  You'd have to copy the SQL part of the RecentTopics() function from Recent.php and you should be able to get something to work.
Hello,
hmmm.. I edit file BoardIndex.template.php and I paste
//recent post


echo '
<div class="tborder" ', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'style="width: 100%;"' : '', '>
<table border="0" width="100%" cellspacing="0" cellpadding="4" class="bordercolor" id="topicTable">
<tr>';

// Are there actually any topics to show?
echo '
<td width="15%" class="catbg3"><strong>', $txt['smf82'], '</strong></td>
<td class="catbg3"><strong>', $txt[118], '</strong></td>
<td width="50" class="catbg3" align="center"><strong>', $txt[110], '</strong></td>
<td width="150" class="catbg3" align="center"><strong>', $txt[109], '</strong></td>
<td width="150" class="catbg3" align="center"><strong>', $txt[22], '</strong></td>
<td width="16" class="catbg3"></td>';

// No topics.... just say, "sorry bub".
if (empty($context['topics']))
echo '
</tr>
<tr id="no_topics">
<td class="windowbg2" width="100%" colspan="6"><strong>', $txt[151], '</strong></td>';

echo '
</tr>';

foreach ($context['topics'] as $topic)
{
echo '
<tr class="windowbg2" id="topic_', $topic['id'], '">
<td class="smalltext" style="padding-left: 10px; border-bottom: 1px solid rgb(204, 204, 204);">', $topic['board']['link'], '</td>
<td style="padding-left: 10px; border-bottom: 1px solid rgb(204, 204, 204);">', $topic['link'], '</td>
<td align="center" class="smalltext" style="border-bottom: 1px solid rgb(204, 204, 204);">', $topic['replies'], '</td>
<td align="center" class="smalltext" style="border-bottom: 1px solid rgb(204, 204, 204);">', $topic['firstPoster']['link'], '<br />', $topic['firstPoster']['time'], '</td>
<td align="center" class="smalltext" style="border-bottom: 1px solid rgb(204, 204, 204);">', $topic['lastPoster']['link'], '<br />', $topic['lastPoster']['time'], '</td>
<td align="center" style="border-bottom: 1px solid rgb(204, 204, 204);"><a href="', $topic['lastPost']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt[111], '" title="', $txt[111], '" /></a></td>
</tr>';
}

echo '
</table>
</div>';

// Now for all of the javascript stuff
echo '
<script language="Javascript" type="text/javascript"><!-- // -->
var last_post = ', (!empty($context['last_post_time']) ? $context['last_post_time'] : 0), ';
var time_interval = ', $settings['number_recent_topics_interval'] * 1000, ';
var max_topics = ', $settings['number_recent_topics'], ';

var interval_id = setInterval( "getTopics()", time_interval);

function getTopics()
{
if (window.XMLHttpRequest)
getXMLDocument("', $scripturl, '?action=recenttopics;latest=" + last_post + ";xml", gotTopics);
else
clearInterval(interval_id);
}

function gotTopics(XMLDoc)
{
var updated_time = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("lastTime")[0];
var topics = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("topic");
var topic, id_topic, board, subject, replies, firstPost, lastPost, link;
var myTable = document.getElementById("topicTable"), oldRow, myRow, myCell, myData, rowCount;

// If this exists, we have at least one updated/new topic
if (updated_time)
{
// Update the last post time
last_post = updated_time.childNodes[0].nodeValue;

// No Messages message?  Ditch it!
// Note, this should only happen if there are literally zero topics
// on the board when a user visits this page.
if (document.getElementById("no_topics") != null)
myTable.deleteRow(-1);

// If the topic is already in the list, remove it
for (var i = 0; i < topics.length; i++)
{
topic = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("topic")[i];
id_topic = topic.getElementsByTagName("id")[0].childNodes[0].nodeValue;
if ((oldRow = document.getElementById("topic_" + id_topic)) != null)
myTable.deleteRow(oldRow.rowIndex);
}

// Are we going to exceed the maximum topic count allowed?
while (((myTable.rows.length - 1 + topics.length) - max_topics) > 0)
myTable.deleteRow(-1);

// Now start the insertion
for (var i = 0; i < topics.length; i++)
{
// Lets get all of our data
topic = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("topic")[i];
id_topic = topic.getElementsByTagName("id")[0].childNodes[0].nodeValue;
board = topic.getElementsByTagName("board")[0].childNodes[0].nodeValue;
subject = topic.getElementsByTagName("subject")[0].childNodes[0].nodeValue;
replies = topic.getElementsByTagName("replies")[0].childNodes[0].nodeValue;
firstPost = topic.getElementsByTagName("first")[0].childNodes[0].nodeValue;
lastPost = topic.getElementsByTagName("last")[0].childNodes[0].nodeValue;
link = topic.getElementsByTagName("lastLink")[0].childNodes[0].nodeValue;

// Now to create the new row...
myRow = myTable.insertRow(1);
myRow.id = "topic_" + id_topic;
myRow.className = "windowbg";

// First the Board
myCell = myRow.insertCell(-1);
myCell.className = "smalltext";
myCell.style.paddingLeft = "10px";
myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
setInnerHTML(myCell, board);

// Then subject
myCell = myRow.insertCell(-1);
myCell.style.paddingLeft = "10px";
myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
setInnerHTML(myCell, subject);

// replies
myCell = myRow.insertCell(-1);
myCell.className = "smalltext";
myCell.align = "center"
myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
setInnerHTML(myCell, replies);

// first post
myCell = myRow.insertCell(-1);
myCell.className = "smalltext";
myCell.align = "center"
myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
setInnerHTML(myCell, firstPost);

// last post
myCell = myRow.insertCell(-1);
myCell.className = "smalltext";
myCell.align = "center"
myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
setInnerHTML(myCell, lastPost);

// last post
myCell = myRow.insertCell(-1);
myCell.align = "center"
myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
setInnerHTML(myCell, link);
}
}
}
// ]]></script>';

In Board Index the Recent Topics was displayed but after few minuts... :( Example in standard Recent Post on site the results of new post and topic was displayed on page load ...

The problem is why the Recent Topics isn't display on load page such as standard (default) Recent post's after The Center Info place... ?
BTW  I edit BoardIndex.php too with your sugestion but the Recent Topics
Title: Re: AJAX Recent Topics
Post by: SlammedDime on July 18, 2008, 03:45:32 PM
You have to edit both, the template and the source file.  Looks like you have the template right, but the source file (BoardIndex.php) needs to be modified too, to perform the SQL query and setup the $context variable.
Title: Re: AJAX Recent Topics
Post by: qubbah on August 07, 2008, 01:39:43 PM
How can i make this code to show the latest post in the top not at the bottom?

//recent post
   
   
   echo '
      <div class="tborder" ', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'style="width: 100%;"' : '', '>
         <table border="0" width="100%" cellspacing="0" cellpadding="4" class="bordercolor" id="topicTable">
            <tr>';

   // Are there actually any topics to show?
   echo '
               <td width="15%" class="catbg3"><strong>', $txt['smf82'], '</strong></td>
               <td class="catbg3"><strong>', $txt[118], '</strong></td>
               <td width="50" class="catbg3" align="center"><strong>', $txt[110], '</strong></td>
               <td width="150" class="catbg3" align="center"><strong>', $txt[109], '</strong></td>
               <td width="150" class="catbg3" align="center"><strong>', $txt[22], '</strong></td>
               <td width="16" class="catbg3"></td>';

   // No topics.... just say, "sorry bub".
   if (empty($context['topics']))
      echo '
            </tr>
            <tr id="no_topics">
               <td class="windowbg2" width="100%" colspan="6"><strong>', $txt[151], '</strong></td>';

   echo '
            </tr>';
   
   foreach ($context['topics'] as $topic)
   {
      echo '
            <tr class="windowbg2" id="topic_', $topic['id'], '">
               <td class="smalltext" style="padding-left: 10px; border-bottom: 1px solid rgb(204, 204, 204);">', $topic['board']['link'], '</td>
               <td style="padding-left: 10px; border-bottom: 1px solid rgb(204, 204, 204);">', $topic['link'], '</td>
               <td align="center" class="smalltext" style="border-bottom: 1px solid rgb(204, 204, 204);">', $topic['replies'], '</td>
               <td align="center" class="smalltext" style="border-bottom: 1px solid rgb(204, 204, 204);">', $topic['firstPoster']['link'], '<br />', $topic['firstPoster']['time'], '</td>
               <td align="center" class="smalltext" style="border-bottom: 1px solid rgb(204, 204, 204);">', $topic['lastPoster']['link'], '<br />', $topic['lastPoster']['time'], '</td>
               <td align="center" style="border-bottom: 1px solid rgb(204, 204, 204);"><a href="', $topic['lastPost']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt[111], '" title="', $txt[111], '" /></a></td>
            </tr>';
   }
   
   echo '
         </table>
      </div>';
   
   // Now for all of the javascript stuff
   echo '
      <script language="Javascript" type="text/javascript"><!-- // -->
         var last_post = ', (!empty($context['last_post_time']) ? $context['last_post_time'] : 0), ';
         var time_interval = ', $settings['number_recent_topics_interval'] * 1000, ';
         var max_topics = ', $settings['number_recent_topics'], ';
         
         var interval_id = setInterval( "getTopics()", time_interval);

         function getTopics()
         {
            if (window.XMLHttpRequest)
               getXMLDocument("', $scripturl, '?action=recenttopics;latest=" + last_post + ";xml", gotTopics);
            else
               clearInterval(interval_id);
         }
         
         function gotTopics(XMLDoc)
         {
            var updated_time = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("lastTime")[0];
            var topics = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("topic");
            var topic, id_topic, board, subject, replies, firstPost, lastPost, link;
            var myTable = document.getElementById("topicTable"), oldRow, myRow, myCell, myData, rowCount;
           
            // If this exists, we have at least one updated/new topic
            if (updated_time)
            {
               // Update the last post time
               last_post = updated_time.childNodes[0].nodeValue;
               
               // No Messages message?  Ditch it!
               // Note, this should only happen if there are literally zero topics
               // on the board when a user visits this page.
               if (document.getElementById("no_topics") != null)
                  myTable.deleteRow(-1);
               
               // If the topic is already in the list, remove it
               for (var i = 0; i < topics.length; i++)
               {
                  topic = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("topic")[i];
                  id_topic = topic.getElementsByTagName("id")[0].childNodes[0].nodeValue;
                  if ((oldRow = document.getElementById("topic_" + id_topic)) != null)
                     myTable.deleteRow(oldRow.rowIndex);
               }
               
               // Are we going to exceed the maximum topic count allowed?
               while (((myTable.rows.length - 1 + topics.length) - max_topics) > 0)
                  myTable.deleteRow(-1);
               
               // Now start the insertion
               for (var i = 0; i < topics.length; i++)
               {
                  // Lets get all of our data
                  topic = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("topic")[i];
                  id_topic = topic.getElementsByTagName("id")[0].childNodes[0].nodeValue;
                  board = topic.getElementsByTagName("board")[0].childNodes[0].nodeValue;
                  subject = topic.getElementsByTagName("subject")[0].childNodes[0].nodeValue;
                  replies = topic.getElementsByTagName("replies")[0].childNodes[0].nodeValue;
                  firstPost = topic.getElementsByTagName("first")[0].childNodes[0].nodeValue;
                  lastPost = topic.getElementsByTagName("last")[0].childNodes[0].nodeValue;
                  link = topic.getElementsByTagName("lastLink")[0].childNodes[0].nodeValue;
                 
                  // Now to create the new row...
                  myRow = myTable.insertRow(1);
                  myRow.id = "topic_" + id_topic;
                  myRow.className = "windowbg";
                 
                  // First the Board
                  myCell = myRow.insertCell(-1);
                  myCell.className = "smalltext";
                  myCell.style.paddingLeft = "10px";
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, board);
                 
                  // Then subject
                  myCell = myRow.insertCell(-1);
                  myCell.style.paddingLeft = "10px";
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, subject);
                 
                  // replies
                  myCell = myRow.insertCell(-1);
                  myCell.className = "smalltext";
                  myCell.align = "center"
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, replies);
                 
                  // first post
                  myCell = myRow.insertCell(-1);
                  myCell.className = "smalltext";
                  myCell.align = "center"
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, firstPost);
                 
                  // last post
                  myCell = myRow.insertCell(-1);
                  myCell.className = "smalltext";
                  myCell.align = "center"
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, lastPost);
                 
                  // last post
                  myCell = myRow.insertCell(-1);
                  myCell.align = "center"
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, link);
               }
            }
         }
      // ]]></script>';
Title: Re: AJAX Recent Topics
Post by: SlammedDime on August 07, 2008, 02:51:45 PM
I don't understand the question... the latests topics do show at the top, that's the purpose of the mod.
Title: Re: AJAX Recent Topics
Post by: qubbah on August 07, 2008, 02:54:02 PM
ok thank u...

how we make when user click the latest post it go to the last real post of that topic not the first post?
Title: Re: AJAX Recent Topics
Post by: SlammedDime on August 07, 2008, 03:44:56 PM
It should be going to the newest post in the topic that that particular user hasn't read yet.  So if there are 5 posts the user hasn't read, it will go to the 5th last post.  If there is only one post the user hasn't read (the last one), that's where it will go.
Title: Re: AJAX Recent Topics
Post by: qubbah on August 07, 2008, 03:51:31 PM
Quote from: SlammedDime on August 07, 2008, 03:44:56 PM
It should be going to the newest post in the topic that that particular user hasn't read yet.  So if there are 5 posts the user hasn't read, it will go to the 5th last post.  If there is only one post the user hasn't read (the last one), that's where it will go.

I think i have a problem because when i click Post Subject it is going to the first post for that topic.
If the topic have 20 post, its going to the first post not to the 20.

It is not same when i click last_post.gif its go to the reallast post.
Title: Re: AJAX Recent Topics
Post by: SlammedDime on August 07, 2008, 06:58:32 PM
Sorry for the confustion, you weren't really clear on what you were clicking before, but Yea, that's how it's supposed to work.  I wouldn't recommend changing it as if search engines get ahold of that page, it could provide an easy way for them to grab latest topics on your site.  If you still want, I'll look at the code and let you know how to change it up.
Title: Re: AJAX Recent Topics
Post by: qubbah on August 07, 2008, 08:44:22 PM
Quote from: SlammedDime on August 07, 2008, 06:58:32 PM
Sorry for the confustion, you weren't really clear on what you were clicking before, but Yea, that's how it's supposed to work.  I wouldn't recommend changing it as if search engines get ahold of that page, it could provide an easy way for them to grab latest topics on your site.  If you still want, I'll look at the code and let you know how to change it up.

TQ... i will wait for it...
Title: Re: AJAX Recent Topics
Post by: CrimsonSun99 on September 18, 2008, 03:07:07 PM
Will there be an update for 2.0.4?
Title: Re: AJAX Recent Topics
Post by: SlammedDime on September 18, 2008, 03:31:31 PM
It shouldn't require one, you are welcome to try to install it.  I will update it however to fix a bug in the SQL query that caused it to lag on large boards, so I would probably wait for that update (perhaps in the next 30 minutes).
Title: Re: AJAX Recent Topics
Post by: SlammedDime on September 18, 2008, 03:59:27 PM
Ok, updated.
Title: Re: AJAX Recent Topics
Post by: tridirk on September 19, 2008, 02:18:55 AM
I like this idea a lot.  But I when I try and install it via the package installer, I get an error message, and am advised not to install it.
Title: Re: AJAX Recent Topics
Post by: SlammedDime on September 19, 2008, 04:33:53 AM
I can't really help much if you don't let me know which version of SMF you're running and what file shows the error (or in the case of 2.0, which edit fails).  If you do have 1.1.6, please attach whatever file failed also.
Title: Re: AJAX Recent Topics
Post by: tridirk on September 19, 2008, 10:55:12 AM
Hi, Sorry... version 1.1.5

and the error
Title: Re: AJAX Recent Topics
Post by: SlammedDime on September 19, 2008, 02:20:18 PM
The manual install instructions are available on the download page for the mod, look at the instructions for index.template.php, there are only two very simple instructions for that file.  Install the mod, ignorning the errors, then go into index.template.php and make the changes prescribed in the instructions.
Title: Re: AJAX Recent Topics
Post by: CrimsonSun99 on September 19, 2008, 02:24:26 PM
Thank you very much for the update, my users love your mod.
Title: Re: AJAX Recent Topics
Post by: tridirk on September 19, 2008, 05:23:23 PM
Quote from: SlammedDime on September 19, 2008, 02:20:18 PM
The manual install instructions are available on the download page for the mod, look at the instructions for index.template.php, there are only two very simple instructions for that file.  Install the mod, ignorning the errors, then go into index.template.php and make the changes prescribed in the instructions.

Thank you I will give it a go.  I like the idea very much, thanks for setting it up.
Title: Re: AJAX Recent Topics
Post by: F4r4Zm0In on September 23, 2008, 02:06:53 PM
I am using smf 1.1.6, using "classic" theme which comes with the default smf installation

while installing AJAX Recent Topics       1.0.1

i have got this >>

QuoteError in Package Installation
Type      Action      Description
1.     Execute Modification     ./index.php     Test successful
2.     Execute Modification     ./Sources/Recent.php     Test successful
3.     Execute Modification     ./Themes/classic/index.template.php     Test failed
4.     Execute Modification     ./Themes/classic/languages/Modifications.english.php     Test successful
5.     Execute Modification     ./Themes/classic/Recent.template.php     Test successful
6.     Execute Modification     ./Themes/classic/Settings.template.php     Test successful
7.     Execute Code     add_settings_1_1.php   

any ideas ???
Title: Re: AJAX Recent Topics
Post by: SlammedDime on September 23, 2008, 07:18:54 PM
From my post above...
Quote from: SlammedDime on September 19, 2008, 02:20:18 PM
The manual install instructions are available on the download page for the mod, look at the instructions for index.template.php, there are only two very simple instructions for that file.  Install the mod, ignorning the errors, then go into index.template.php and make the changes prescribed in the instructions.
Title: Re: AJAX Recent Topics
Post by: matasanos on September 28, 2008, 04:00:05 PM
other ajax mod that ROCKS!!

THANKS
working fine
Title: Re: AJAX Recent Topics
Post by: vladimir - sv on September 28, 2008, 05:11:11 PM
Thank you, it worked fine with Royale theme.

http://foro.todosv.com/index.php?action=recenttopics
Title: Re: AJAX Recent Topics
Post by: Sudhakar Arjunan on October 11, 2008, 11:26:44 AM
Thanks a lot to SlammedDime.

A very useful mod. Which i was using every moment to check the large amount of post made by our community users.

I have a query SlammedDime,

If possible, will you built a new mod. Which shows the users who made the post.
If he has already made, will that show no of post or replies he/she makes.

But all stats should only for daily and not more than the days effort.
Title: Re: AJAX Recent Topics
Post by: TechPrince on October 23, 2008, 05:42:04 PM
How about pagination and Start/Stop support?
Title: Re: AJAX Recent Topics
Post by: SlammedDime on October 23, 2008, 06:11:01 PM
Won't be doing pagination, as it kinda defeats the purpose of the mod.  Start/stop will come out in the new version as 2.0 hits the RC stages.
Title: Re: AJAX Recent Topics
Post by: qubbah on October 25, 2008, 10:02:26 AM
how can we put new.gif besides the new post that e doesnt read it yet?
Title: Re: AJAX Recent Topics
Post by: SlammedDime on October 25, 2008, 12:05:43 PM
The SQL query would have to be re-written.  I purposely left it out, but I can take a look at putting it back in, i really don't see the purpose of them considering the idea behind the mod in the first place.
Title: Re: AJAX Recent Topics
Post by: qu3ll0 on October 31, 2008, 08:24:55 AM
Thank-you so much for that nice mod.
Title: Re: AJAX Recent Topics
Post by: Septimus on November 24, 2008, 05:54:25 PM
Could you please make it so there is an action when viewing recenttopics? So people dont have "unknown action"?

It freaks my admins out :-X.


Thanks!
Title: Re: AJAX Recent Topics
Post by: SlammedDime on November 24, 2008, 05:58:12 PM
Septimus - the next version will have that.

Jade also discovered a slight bug when a user left this script running for a few weeks non stop... the hit count on her board skyrocketed... I'll fix that as well.
Title: Re: AJAX Recent Topics
Post by: Jade Elizabeth on November 24, 2008, 06:07:52 PM
+50,000 page views

/me makes a thudding sound as she hits the floor
Title: Re: AJAX Recent Topics
Post by: qu3ll0 on November 25, 2008, 04:02:48 PM
Hey man, great mod!!!  ;)

However, you should call this mod "AJAX recent posts" instead of "AJAX recent topics" since it takes into account the latest replies too.

Do you think it is possible to get the mod to retrieve just the LATEST NEW TOPICS without taking into account the recent replies?

Many many thanks!
Title: Re: AJAX Recent Topics
Post by: SlammedDime on November 25, 2008, 04:11:49 PM
That would require rewriting the entire SQL query.  I suppose I could add an option and add more to the mod so that you can choose if it shows updated topics, or only new topics.
Title: Re: AJAX Recent Topics
Post by: qu3ll0 on November 25, 2008, 04:42:48 PM
It would be really appreciated!

Thanks a lot ;)
Title: Re: AJAX Recent Topics
Post by: espressoguy on December 01, 2008, 12:54:44 AM
Great Mod, SlammedDime!!   O:)  I think this is really a standard feature for most forums ...right?  I was surprised that SMF doesn't really have it in the original install. 

I notice that by default it returns the last 50 posts.  Is there any plan to have it return pages of 50 so that the user could page back through the 50 most recent posts at a time?  Just curious as to how much of an effort this would be ...the mod is really great and useful just as-is.

Thanks alot !!  8) 
Title: Re: AJAX Recent Topics
Post by: vulcan59 on December 01, 2008, 03:43:10 AM
Hi,

I tried installing this mod but it just doesn't come out right. I am using ApolloBB theme with SMF 1.1.7. I uploaded the mod and it install through packages okay with no errors.

I then do a manual edit to the ApolloBB index.template, settings.template and the Modification.english.php and there is no recent.template in ApolloBB.

After the mods, the recent topic appears in the search button area on the top right hand corner and the logout button disappears!!  ???

What am I doing wrong? Any help would be appreciated.

Cheers.
Title: Re: AJAX Recent Topics
Post by: SlammedDime on December 01, 2008, 05:12:43 AM
expressoguy - pagination would be slightly difficult, but I'll play with it.

vulcan59 - Sounds like you didn't edit index.template.php correctly.  Can you attach it to your next post please?
Title: Re: AJAX Recent Topics
Post by: vulcan59 on December 01, 2008, 01:34:06 PM
Hi SlammedDime,

I've attached the index.template without any modifications to it yet.

I've done quite a few mods manually and so far I had no problems.

Anyway thanks for having a look.

Regards.
Title: Re: AJAX Recent Topics
Post by: vulcan59 on December 03, 2008, 01:47:09 PM
Hi SlammedDime,

Attached is the index.template from my ApolloBB theme that I did amend. Can't see what's wrong with it.

Also do I have to edit settings.template.php and the Modifications.english.php in the ApolloBB theme as well?

Regards.
Title: Re: AJAX Recent Topics
Post by: SlammedDime on December 03, 2008, 02:37:19 PM
I must be losing my mind in my young age... I could have sworn I uploaded a new copy to a new post for you.  Sorry about that.

The reason for the problem is that your menu is totally different then the core default theme.

As for Settings.template.php, yes, you should edit that.

As for Modifications.english.php, you should take everything in that file, and move it into the Modifications.english.php file in the default theme, then delete the one in your ApolloBB theme.
Title: Re: AJAX Recent Topics
Post by: vulcan59 on December 03, 2008, 03:19:20 PM
Thanks. I carried out the mod and now a whole bunch of error messages as follows:

8: Undefined index: apollobb_footer_sql
File: /mydomain/forum/Themes/default/Admin.template.php (main_below sub template - eval?)
Line: 586


8: Undefined index: apollobb_footer_sql
File: /mydomain/forum/Themes/ApolloBB/BoardIndex.template.php (main_below sub template - eval?)
Line: 586


The line numbers for the BoardIndex.template are different in each error message alternating between Line 583, 584, 585 and 586. No other errors.

Title: Re: AJAX Recent Topics
Post by: SlammedDime on December 03, 2008, 06:40:38 PM
Those don't have anything to do with this mod... not sure why you would be getting them.
Title: Re: AJAX Recent Topics
Post by: vulcan59 on December 03, 2008, 09:16:21 PM
Well since it's such a problem, I've uninstalled it and reverted back to original, until I can figure out what to do or someone can give me more guidance to resolve the issue.

Thanks SlammedDime for you help.

Title: Re: AJAX Recent Topics
Post by: SlammedDime on December 04, 2008, 12:14:28 AM
Looks like it's because of a missing text string.  When you copied everything to Modifications.english.php in your default directory, did you make sure everything made it over??
Title: Re: AJAX Recent Topics
Post by: vulcan59 on December 04, 2008, 01:43:46 PM
Hi SlammedDime,

Perhaps I am doing it wrong. Here is how I have been doing it.

I first edit the 3 files in my ApolloBB theme. I then log in go to admin and using the package module, I install it and it reports install successful. I then log out and go to my ftp program (FileZilla) and upload the 3 ApolloBB files into the relevant folders. I do a hard refresh and log in again but the "Recent Topic" doesn't show up at all.

When I click the "read recent post" in the info center, I get a warning message of some error. My forum error log records a whole bunch of the errors I listed above.

I'll start from scratch again and try to do another install and will let you know how it goes unless there is a better way to do it?
Title: Re: AJAX Recent Topics
Post by: SlammedDime on December 04, 2008, 07:32:31 PM
Are you sure you're uploading the files to the right place?  Rather, after you upload them, if you download them again, are they they changed files??
Title: Re: AJAX Recent Topics
Post by: vulcan59 on December 04, 2008, 09:28:33 PM
Hi SlammedDime,

Just did the mod another time and this time, there were no errors reported in the Forum error log but the "Recent topics" still doesn't show up.

However when I click the "View the most recent post on the forum" I got a new browser window with the following error:-
Quote
Fatal error: Cannot redeclare recenttopics() (previously declared in /mydomain/forum/Sources/Recent.php:1106) in
/mydomain/forum/Sources/Recent.php on line 1402

Exactly the same errors show when I click "Show unread post since last visit" or when I click "Show new replies to your post.

After uploading the files,  I downloaded them again to check and yes they appear to be exact copies of the amended files.

I am running SMF 1.1.7 with SMF 1.0.15 / 1.1.7 Update and IP2Location mods installed and no other.

Title: Re: AJAX Recent Topics
Post by: SlammedDime on December 04, 2008, 09:34:04 PM
Looks like Recent.php has had the mod installed twice (there are two function blocks of recenttopics()).  One needs to be deleted, however that will still not make the recent topics button show up in your tool bar.

Do you have any errors in your error log that state  Undefined Index: recent_topics ?.  I'm wondering if the language strings are not making through.  (this is why I advise that a custom theme NEVER have it's own Modifications.english.php file.  Only the default theme should ever have this file, because it can cause too many issues.
Title: Re: AJAX Recent Topics
Post by: vulcan59 on December 04, 2008, 09:54:21 PM
Nope no errors whatsoever in the Forum error log, even when I was clicking and gettin the errors listed above.

Attached is the current recent.php. (on the forum right now)
Title: Re: AJAX Recent Topics
Post by: SlammedDime on December 05, 2008, 12:49:54 AM
Well that doesn't make sense, that error refers to a line that doesn't even exist in that copy of Recent.php.

As it stands, does the package manager currently show the package as installed, or uninstalled?
Title: Re: AJAX Recent Topics
Post by: vulcan59 on December 05, 2008, 12:52:48 AM
After installation, it does show as installed but I had to uninstall it since I am getting so many problems.

Title: Re: AJAX Recent Topics
Post by: SlammedDime on December 05, 2008, 01:01:21 AM
Ok, because the file that you posted has the mod installed in it.  You'll want to remove the RecentTopics() function from it to completely uninstall the mod, and I would check the rest of the files that the mod modifies to be sure it uninstalled from them as well.
Title: Re: AJAX Recent Topics
Post by: vulcan59 on December 05, 2008, 01:24:50 AM
Okay I'll do that and get back to you here.

Thanks for the advice.

Title: Re: AJAX Recent Topics
Post by: Sakae on December 15, 2008, 07:04:16 AM
Morning.

Any chances to see a SSI function of this mod? I'd love to replace the default  ssi_recentTopics(); for this feature.
Title: Re: AJAX Recent Topics
Post by: SlammedDime on December 15, 2008, 07:54:52 AM
might be possible, I'll look into it.
Title: Re: AJAX Recent Topics
Post by: Sakae on December 16, 2008, 06:24:25 PM
Quote from: SlammedDime on December 15, 2008, 07:54:52 AM
might be possible, I'll look into it.

Awesome! Can't wait to see it! :)
Title: Re: AJAX Recent Topics
Post by: SlowPaddle on December 21, 2008, 06:25:24 AM
Even though I've changed the number of recent topics to show to 20,  the mod still gives me 50.

Can anyone tell me where the value for the number of recent topic to display is located so I can change it manually?

Thanks
Title: Re: AJAX Recent Topics
Post by: SlammedDime on December 21, 2008, 07:48:47 AM
Where exactly did you change it at?

I just reviewed the code really quick to make sure it was not hard coded and it is indeed not hardcoded to 50.

The proper place for the setting is in your Theme Settings for your particular theme.
Title: Re: AJAX Recent Topics
Post by: SlammedDime on December 21, 2008, 10:07:14 AM
Well that's just it, the variable is set and viewed through the Settings of your theme... can you provide me with admin access on your site so I can take a look at what is going on?  No one else has reported this so it's quite odd that it's not working.
Title: Re: AJAX Recent Topics
Post by: SlowPaddle on December 21, 2008, 10:08:41 AM
I was using the Tolkein theme and it doesn't show those settings in the admin area.

So I switched it back to the default theme and managed to get it to work.

Good mod BTW.

Title: Re: AJAX Recent Topics
Post by: SlammedDime on December 21, 2008, 10:10:07 AM
You'll have to make the changes to your Settings.template.php file in your custom theme as well so those options show.
Title: Re: AJAX Recent Topics
Post by: SlowPaddle on December 21, 2008, 10:18:00 AM
I'm not quite sure how to do this but I'll try to modify it.

Thanks for the tip.

Edited: I managed to add the options into the template. Thanks again for your help.
Title: Re: AJAX Recent Topics
Post by: Özgür on January 06, 2009, 03:20:24 PM
Quote from: SlammedDime on December 15, 2008, 07:54:52 AM
might be possible, I'll look into it.

any update ? =)
Title: Re: AJAX Recent Topics
Post by: SlammedDime on January 06, 2009, 03:22:18 PM
I haven't had time to work on a new version yet, probably won't start until 2.0 RC1 is released.
Title: Re: AJAX Recent Topics
Post by: Apllicmz on January 06, 2009, 09:48:57 PM
Good mod
can update portuguese_pt and utf8

<file name="$languagedir/Modifications.portuguese_pt.php" error="skip">
        <operation>
            <search position="after"><![CDATA[?>]]></search>
            <add><![CDATA[// AJAX Recent Topics
$txt['recent_topics'] = 'T&oacute;picos recentes';
$txt['minutes_ago'] = ' minutos atr&aacute;s';
$txt['number_recent_topics_interval'] = 'Tempo demora (em segundos) entre os testes para actualiza&ccedil;&atilde;o dos t&oacute;picos';
$txt['number_recent_topics_interval_desc'] = 'N&atilde;o muito baixo, segundo uma 5/10 demora &eacute; razo&aacute;vel';
$txt['number_recent_topics'] = 'T&oacute;picos para serem exibidos em recente T&oacute;pico p&aacute;gina';

]]></add>
        </operation>
    </file>
    <file name="$languagedir/Modifications.portuguese_pt-utf8.php" error="skip">
        <operation>
            <search position="after"><![CDATA[?>]]></search>
            <add><![CDATA[// AJAX Recent Topics
$txt['recent_topics'] = 'T&oacute;picos recentes';
$txt['minutes_ago'] = ' minutos atr&aacute;s';
$txt['number_recent_topics_interval'] = 'Tempo demora (em segundos) entre os testes para actualiza&ccedil;&atilde;o dos t&oacute;picos';
$txt['number_recent_topics_interval_desc'] = 'N&atilde;o muito baixo, segundo uma 5/10 demora &eacute; razo&aacute;vel';
$txt['number_recent_topics'] = 'T&oacute;picos para serem exibidos em recente T&oacute;pico p&aacute;gina';

]]></add>
        </operation>


thank you
Title: Re: AJAX Recent Topics
Post by: AlaStar on January 18, 2009, 06:20:49 AM
SlammedDime this mod works with table of recent posts on BoardIndex ?
I needed similar thing that updated automatically via AJAX my table of recent posts.  :P

Title: Re: AJAX Recent Topics
Post by: SlammedDime on January 18, 2009, 07:47:32 AM
No, this creates a new action similar to ?action=recent

Title: Re: AJAX Recent Topics
Post by: AlaStar on January 19, 2009, 03:00:29 AM
ok, thanks  ;)
Title: Re: AJAX Recent Topics
Post by: bjraines on January 20, 2009, 08:43:03 PM
I have an seo question

your link at the end of each row to the last post in the thread, does not trigger the robots no follow

so in effect it is creating a new different link to the same topic

has this caused any seo error sfor anyone

is there a way for it to trigger the robots no follow on the link
Title: Re: AJAX Recent Topics
Post by: spartanic on January 26, 2009, 08:23:01 PM
The package installed without a hiccup but now how do enable it? I've searched the admin and cannot find any features to turn this on.
Title: Re: AJAX Recent Topics
Post by: SlammedDime on January 26, 2009, 08:27:15 PM
There's nothing needed to turn it on... a link appears in your menu with 'Home', 'Memberlist', etc.  If you have a custom theme, you'll need to modify it for the custom theme as well.  The settings for it are under your current theme settings.  If your theme has a custom Settings.template.php, you'll need to add the appropriate code to that as well.
Title: Re: AJAX Recent Topics
Post by: spartanic on January 26, 2009, 10:11:27 PM
I'm actually still using the default theme. I don't see that option in the menu. Any ideas?

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.tunerselect.com%2Fmisc%2Fmenu.gif&hash=817103a627b4974423cc160005b8421dd554b18c)
Title: Re: AJAX Recent Topics
Post by: SlammedDime on January 27, 2009, 05:02:27 AM
There's a space for it there, between My Messages and Members.  If you're using English-UTF8 as your language vs just English, you'll need to add the language strings to Modifications.English-utf8.php as well.
Title: Re: AJAX Recent Topics
Post by: psi0 on February 08, 2009, 02:17:24 PM
Any news about update SMF 2.0 RC1 ?
Title: Re: AJAX Recent Topics
Post by: SlammedDime on February 08, 2009, 02:37:48 PM
This should work with rc1 without a problem... although I will probably rewrite it and do a bug fix release as well.  Still have my other mods to update as well.
Title: Re: AJAX Recent Topics
Post by: psi0 on February 09, 2009, 07:31:05 AM
Can´t install in a fresh install. I think it´s package-info.xml ? Thanks
Title: Re: AJAX Recent Topics
Post by: SlammedDime on February 09, 2009, 10:19:46 AM
If you can't install because it just says it's not compatible with your version, then you can click on the 'Advanced Options' at the bottom of the package manager and change the version to 2.0 Beta 4 and try again.
Title: Re: AJAX Recent Topics
Post by: TechPrince on February 09, 2009, 01:33:45 PM
Quote from: SlammedDime on October 23, 2008, 06:11:01 PM
Won't be doing pagination, as it kinda defeats the purpose of the mod.  Start/stop will come out in the new version as 2.0 hits the RC stages.

RC1 is public :)
Title: Re: AJAX Recent Topics
Post by: SlammedDime on February 09, 2009, 02:44:12 PM
It is?? ;)

Quote from: SlammedDime on February 08, 2009, 02:37:48 PM
This should work with rc1 without a problem... although I will probably rewrite it and do a bug fix release as well.  Still have my other mods to update as well.
Title: Re: AJAX Recent Topics
Post by: TechPrince on February 11, 2009, 07:34:21 PM
Start / Stop :(
Title: Re: AJAX Recent Topics
Post by: SlammedDime on February 11, 2009, 07:38:21 PM
I'll probably work on this tomorrow.  I'm probably going to rewrite it like I did the sitemap mod to use more 2.0 native methods.  Might introduce some new features too... ;)
Title: Re: AJAX Recent Topics
Post by: Mikeric on March 03, 2009, 12:37:25 PM
Quote from: SlammedDime on February 11, 2009, 07:38:21 PM
I'll probably work on this tomorrow.  I'm probably going to rewrite it like I did the sitemap mod to use more 2.0 native methods.  Might introduce some new features too... ;)

Have you done anything on this mod yet? Just wondering since it is probably the most requested one since i updated.
Title: Re: AJAX Recent Topics
Post by: SlammedDime on March 03, 2009, 02:39:52 PM
Since I'm trying to use some of SMF's more native functions, it's a little bit more difficult to do exactly what needs to be done, but I almost have it working.  The javascript needs to be reworked to function properly since the layout is changing, and I'm still working on finding a way to dynamically update the time it was posted, so it just doesn't say '0 minutes ago' and never changes.
Title: Re: AJAX Recent Topics
Post by: Antechinus on March 10, 2009, 06:49:10 PM
Cool. Will be happy to help test the thing once you have it going.
Title: Re: AJAX Recent Topics
Post by: qubbah on March 28, 2009, 01:19:19 AM
how to put it in block for tinyportal?
Title: Re: AJAX Recent Topics
Post by: SlammedDime on March 28, 2009, 01:49:04 AM
You can't.
Title: Re: AJAX Recent Topics
Post by: ZOR0 on April 23, 2009, 07:31:23 PM
Any word on the release for rc1?
Sorry if this is nagging. It's such a great mod, even though i can't get it functional yet.
Title: Re: AJAX Recent Topics
Post by: erdem86 on April 25, 2009, 12:23:15 PM
Hi,

Is there any way to make Recent Topic page to be updated only when a topic is posted.. I mean I don't want topics to go up when they receive reply. I want to show the newest topics on top no matter which one received a reply or not.

And how can I integrate the thumbnails generated by this mod (http://custom.simplemachines.org/mods/index.php?mod=1151) to the recent topics page?
Title: Re: AJAX Recent Topics
Post by: qubbah on May 04, 2009, 02:16:27 PM
IM using this code to put it in the block like for tp.
//recent post
   
   
   echo '
      <div class="tborder" ', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'style="width: 100%;"' : '', '>
         <table border="0" width="100%" cellspacing="0" cellpadding="4" class="bordercolor" id="topicTable">
            <tr>';

   // Are there actually any topics to show?
   echo '
               <td width="15%" class="catbg3"><strong>', $txt['smf82'], '</strong></td>
               <td class="catbg3"><strong>', $txt[118], '</strong></td>
               <td width="50" class="catbg3" align="center"><strong>', $txt[110], '</strong></td>
               <td width="150" class="catbg3" align="center"><strong>', $txt[109], '</strong></td>
               <td width="150" class="catbg3" align="center"><strong>', $txt[22], '</strong></td>
               <td width="16" class="catbg3"></td>';

   // No topics.... just say, "sorry bub".
   if (empty($context['topics']))
      echo '
            </tr>
            <tr id="no_topics">
               <td class="windowbg2" width="100%" colspan="6"><strong>', $txt[151], '</strong></td>';

   echo '
            </tr>';
   
   foreach ($context['topics'] as $topic)
   {
      echo '
            <tr class="windowbg2" id="topic_', $topic['id'], '">
               <td class="smalltext" style="padding-left: 10px; border-bottom: 1px solid rgb(204, 204, 204);">', $topic['board']['link'], '</td>
               <td style="padding-left: 10px; border-bottom: 1px solid rgb(204, 204, 204);">', $topic['link'], '</td>
               <td align="center" class="smalltext" style="border-bottom: 1px solid rgb(204, 204, 204);">', $topic['replies'], '</td>
               <td align="center" class="smalltext" style="border-bottom: 1px solid rgb(204, 204, 204);">', $topic['firstPoster']['link'], '<br />', $topic['firstPoster']['time'], '</td>
               <td align="center" class="smalltext" style="border-bottom: 1px solid rgb(204, 204, 204);">', $topic['lastPoster']['link'], '<br />', $topic['lastPoster']['time'], '</td>
               <td align="center" style="border-bottom: 1px solid rgb(204, 204, 204);"><a href="', $topic['lastPost']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt[111], '" title="', $txt[111], '" /></a></td>
            </tr>';
   }
   
   echo '
         </table>
      </div>';
   
   // Now for all of the javascript stuff
   echo '
      <script language="Javascript" type="text/javascript"><!-- // -->
         var last_post = ', (!empty($context['last_post_time']) ? $context['last_post_time'] : 0), ';
         var time_interval = ', $settings['number_recent_topics_interval'] * 1000, ';
         var max_topics = ', $settings['number_recent_topics'], ';
         
         var interval_id = setInterval( "getTopics()", time_interval);

         function getTopics()
         {
            if (window.XMLHttpRequest)
               getXMLDocument("', $scripturl, '?action=recenttopics;latest=" + last_post + ";xml", gotTopics);
            else
               clearInterval(interval_id);
         }
         
         function gotTopics(XMLDoc)
         {
            var updated_time = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("lastTime")[0];
            var topics = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("topic");
            var topic, id_topic, board, subject, replies, firstPost, lastPost, link;
            var myTable = document.getElementById("topicTable"), oldRow, myRow, myCell, myData, rowCount;
           
            // If this exists, we have at least one updated/new topic
            if (updated_time)
            {
               // Update the last post time
               last_post = updated_time.childNodes[0].nodeValue;
               
               // No Messages message?  Ditch it!
               // Note, this should only happen if there are literally zero topics
               // on the board when a user visits this page.
               if (document.getElementById("no_topics") != null)
                  myTable.deleteRow(-1);
               
               // If the topic is already in the list, remove it
               for (var i = 0; i < topics.length; i++)
               {
                  topic = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("topic")[i];
                  id_topic = topic.getElementsByTagName("id")[0].childNodes[0].nodeValue;
                  if ((oldRow = document.getElementById("topic_" + id_topic)) != null)
                     myTable.deleteRow(oldRow.rowIndex);
               }
               
               // Are we going to exceed the maximum topic count allowed?
               while (((myTable.rows.length - 1 + topics.length) - max_topics) > 0)
                  myTable.deleteRow(-1);
               
               // Now start the insertion
               for (var i = 0; i < topics.length; i++)
               {
                  // Lets get all of our data
                  topic = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("topic")[i];
                  id_topic = topic.getElementsByTagName("id")[0].childNodes[0].nodeValue;
                  board = topic.getElementsByTagName("board")[0].childNodes[0].nodeValue;
                  subject = topic.getElementsByTagName("subject")[0].childNodes[0].nodeValue;
                  replies = topic.getElementsByTagName("replies")[0].childNodes[0].nodeValue;
                  firstPost = topic.getElementsByTagName("first")[0].childNodes[0].nodeValue;
                  lastPost = topic.getElementsByTagName("last")[0].childNodes[0].nodeValue;
                  link = topic.getElementsByTagName("lastLink")[0].childNodes[0].nodeValue;
                 
                  // Now to create the new row...
                  myRow = myTable.insertRow(1);
                  myRow.id = "topic_" + id_topic;
                  myRow.className = "windowbg";
                 
                  // First the Board
                  myCell = myRow.insertCell(-1);
                  myCell.className = "smalltext";
                  myCell.style.paddingLeft = "10px";
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, board);
                 
                  // Then subject
                  myCell = myRow.insertCell(-1);
                  myCell.style.paddingLeft = "10px";
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, subject);
                 
                  // replies
                  myCell = myRow.insertCell(-1);
                  myCell.className = "smalltext";
                  myCell.align = "center"
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, replies);
                 
                  // first post
                  myCell = myRow.insertCell(-1);
                  myCell.className = "smalltext";
                  myCell.align = "center"
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, firstPost);
                 
                  // last post
                  myCell = myRow.insertCell(-1);
                  myCell.className = "smalltext";
                  myCell.align = "center"
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, lastPost);
                 
                  // last post
                  myCell = myRow.insertCell(-1);
                  myCell.align = "center"
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, link);
               }
            }
         }
      // ]]></script>';


But the problem is i want to make the last poster name and the time only show in one row.. then i delete the BR code from <td align="center" class="smalltext" style="border-bottom: 1px solid rgb(204, 204, 204);">', $topic['lastPoster']['link'], '<br />', $topic['lastPoster']['time'], '</td>

but there is nothing change.

Also i try to change last_post.gif to my custom one..
i have change it to , '/icons/last_post2.gif"
also nothing change i can see...

what must i do?
Title: Re: AJAX Recent Topics
Post by: qubbah on May 06, 2009, 03:23:59 PM
how can i change to make when users click the last topic it bring them to the new-latest post in that topic?
Title: Re: AJAX Recent Topics
Post by: SlammedDime on May 06, 2009, 04:26:00 PM
qubbah - i can't really help you on putting it into a block, i'm not familiar with how TP works and I'm almost 99% sure that it will not work in a block.

And it should be taking users to the newest post that they haven't yet read
Title: Re: AJAX Recent Topics
Post by: ttuu on June 10, 2009, 08:01:55 AM
i have one problem.
if i use recenttopics;board=19.0 function.
i see the Recent Topics from this moard. but after 10 sec the page refresh to recenttopics function and i see Recent Topics from all boards.
u can fix?
Title: Re: AJAX Recent Topics
Post by: ryanhellyer on August 03, 2009, 04:45:05 AM
Great plugin! It spat out an error saying that it couldn't update index.template.php, but since I'm not using the default theme I ran with it anyway and everything seems to working flawlessly so far :)

Keep up the good work!
Title: Re: AJAX Recent Topics
Post by: noaccess on August 03, 2009, 05:11:35 AM
Has anyone attempted to change the history length (the number of shouts shown) in the shoutbox? Where exactly is tha piece of code located so I can change it?  O:)
Title: Re: AJAX Recent Topics
Post by: SlammedDime on August 03, 2009, 05:14:16 AM
I think you have the wrong topic...
Title: Re: AJAX Recent Topics
Post by: noaccess on August 03, 2009, 06:11:29 AM
Quote from: SlammedDime on August 03, 2009, 05:14:16 AM
I think you have the wrong topic...
Heh, yeah it would seem so. I interpreted the title the wrong way...
Title: Re: AJAX Recent Topics
Post by: digit on August 03, 2009, 11:32:31 AM
Since there are no permission settings for this - is there a quick hack where I can say ...

if ($context['member']['post_group'] == 9)

{

}

?

I think that URL was made public, and it MAY be bogging my server down.

Thanks in advance.

Title: Re: AJAX Recent Topics
Post by: SlammedDime on August 03, 2009, 03:07:54 PM
If you just want to eliminate guests from viewing it... you can do this in Recent.php

Code (Find) Select
loadTemplate('Recent');
$context['page_title'] = $txt['recent_topics'];
$context['sub_template'] = isset($_REQUEST['xml']) ? 'recent_xml' : 'recent';


Code (Add Above) Select
if (in_array(-1, $user_info['groups']))
redirectexit();
Title: Re: AJAX Recent Topics
Post by: digit on August 03, 2009, 03:57:33 PM
I only want user in groups 9,1 and 2 to view it - if you could help with that - that would be awesome :)
Title: Re: AJAX Recent Topics
Post by: SlammedDime on August 03, 2009, 07:08:01 PM
if (array_intersect($user_info['groups], array(1,2,9)) == array())
      redirectexit();

Compare the current user's groups to that of 1, 2, and 9.  If the resulting array is empty, that member is not part of those groups, thus redirect out.
Title: Re: AJAX Recent Topics
Post by: digit on August 03, 2009, 07:43:18 PM
PEEERFECT - THANKS!  8) :P
Title: Re: AJAX Recent Topics
Post by: K4EEO on August 09, 2009, 02:12:17 PM
This is the most used mod on all of my 1.1 based sites (Thanks! for that) , but I've recently upgraded one of them to  2.0 RC1.2 and the mod says it's not compatible.

Is there a way to use this with 2.0 RC1.2?

Thanks for your time!
Title: Re: AJAX Recent Topics
Post by: K4EEO on August 09, 2009, 03:15:53 PM
never mind.. doing a manual install using the 2.0 Beta 4 parse did the trick ;)

Thanks again for a great mod!
Title: Re: AJAX Recent Topics
Post by: vladok on August 14, 2009, 05:43:05 PM
Quotei have one problem.
if i use recenttopics;board=19.0 function.
i see the Recent Topics from this moard. but after 10 sec the page refresh to recenttopics function and i see Recent Topics from all boards.
u can fix?

Same problem. The author can fix this?
Title: Re: AJAX Recent Topics
Post by: SlammedDime on August 14, 2009, 06:15:39 PM
I've already fixed it for the next version, but due to template changes for 2.0 RC2, a new version won't be released until after that.
Title: Re: AJAX Recent Topics
Post by: vladok on August 15, 2009, 01:41:53 AM
I can change something to fix this error?
Title: Re: AJAX Recent Topics
Post by: vladok on August 15, 2009, 01:47:31 AM
Can the author to introduce a new version of the audio signal to indicate a new post in the topic? Users want to be, with the possibility of switching on and switching off of this option.
Title: Re: AJAX Recent Topics
Post by: qubbah on August 20, 2009, 02:34:18 AM
hope the coder can add sound when having new post.
Title: Re: AJAX Recent Topics
Post by: SlammedDime on August 20, 2009, 03:54:29 AM
Probably won't happen guys, sorry.
Title: Re: AJAX Recent Topics
Post by: fiver on October 05, 2009, 03:41:57 AM
Does this mode detect and update Recent Post when someone clicks "Post"? That will be great.
Title: Re: AJAX Recent Topics
Post by: SlammedDime on October 05, 2009, 03:51:18 AM
I don't understand the question?  It's a realtime updater of the most recently posted to topics.
Title: Re: AJAX Recent Topics
Post by: fiver on October 05, 2009, 04:09:01 AM
 :D

What I meant to ask is - is it possible to make it so that when someone post a reply, it updates straight away. If no one post, there is no need to update every few seconds. So, the update is based on someone posting.

Now that I have installed the mod, I realised that it's for Recent Topics. Does it work for the Recent Post box on the forum home page too?

Title: Re: AJAX Recent Topics
Post by: SlammedDime on October 05, 2009, 02:52:19 PM
No, it's its own action.

It only does update if there are posts, but it has to make ajax calls home to determine that every few seconds.
Title: Re: AJAX Recent Topics
Post by: netoya on October 09, 2009, 03:42:17 AM
Deleted user if he was topic starter on Ajax recent topic page has a link to profile like index.php?action=profile;u=0
Is it possible to fix?
Title: Re: AJAX Recent Topics
Post by: SlammedDime on October 09, 2009, 07:01:48 AM
yea, I'll take a look at this for the next release, thanks.
Title: Re: AJAX Recent Topics
Post by: bjraines on November 06, 2009, 12:42:09 PM
Is it possibly to slightly modify the code to show the recent topics with no replies? I have been really looking for this functionality.
Title: Re: AJAX Recent Topics
Post by: soulgeek on November 11, 2009, 02:18:34 AM
Hello,


QuotePowered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC | Theme Kani By Fussilet

These are the details of my SMF COnfiguration. When i applied the Mod, Nothing happed.  ::)

How to use it? Is it beacasue of the Theme?

Please help.

THanks
Title: Re: AJAX Recent Topics
Post by: vladok on November 22, 2009, 01:28:50 AM
when this mod will be updated for the new version of the SMF (SMF 2.0 RC2) ?
Title: Re: AJAX Recent Topics
Post by: hartiberlin on December 09, 2009, 02:46:08 PM
Hi SlammedDime,
will you soon update this to be compatible with SMF2.0RC2 ?

Many thanks in advance.

Regards, Stefan.
Title: Re: AJAX Recent Topics
Post by: Sudhakar Arjunan on December 13, 2009, 04:31:26 PM
Quote from: hartiberlin on December 09, 2009, 02:46:08 PM
Hi SlammedDime,
will you soon update this to be compatible with SMF2.0RC2 ?

Many thanks in advance.

Regards, Stefan.

Any Idea Author. Thanks in Advance.
Title: Re: AJAX Recent Topics
Post by: Am' on December 16, 2009, 11:45:55 AM
up up up

please new version :D
Title: Re: AJAX Recent Topics
Post by: vladok on December 26, 2009, 12:21:48 PM
author, SMF2.0 RC2.0 released almost 2 months ago. When you plan to update your mod?
Title: Re: AJAX Recent Topics
Post by: Furqon on December 26, 2009, 05:05:44 PM
Quote from: vladok on December 26, 2009, 12:21:48 PM
author, SMF2.0 RC2.0 released almost 2 months ago. When you plan to update your mod?

Just Emulate Package into SMF 2.0 Beta 4

It's running well on SMF 2.0 RC2
Title: Re: AJAX Recent Topics
Post by: ScopeXL on December 26, 2009, 07:06:16 PM
Question,

I am using the code below to insert the recent topics into a block for TinyPortal and am successful, however when the list populates it lists the topics Oldest to Newest (newest being on the bottom) And then as new posts are posted and the AJAX updates, the new posts are placed on top. How do I get this to sort from newest on top to oldest on bottom (like how it works in index.php?action=recenttopics) This is my block code for TinyPortal (its direct from Recent.template.php)


   echo '
      <div class="tborder" ', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'style="width: 100%;"' : '', '>
         <table border="0" width="100%" cellspacing="0" cellpadding="4" class="bordercolor" id="topicTable">
            <tr>';

   // Are there actually any topics to show?
   echo '
               <td width="15%" class="catbg3"><strong>', $txt['smf82'], '</strong></td>
               <td class="catbg3"><strong>', $txt[118], '</strong></td>
               <td width="50" class="catbg3" align="center"><strong>', $txt[110], '</strong></td>
               <td width="150" class="catbg3" align="center"><strong>', $txt[109], '</strong></td>
               <td width="150" class="catbg3" align="center"><strong>', $txt[22], '</strong></td>
               <td width="16" class="catbg3"></td>';

   // No topics.... just say, "sorry bub".
   if (empty($context['topics']))
      echo '
            </tr>
            <tr id="no_topics">
               <td class="windowbg2" width="100%" colspan="6"><strong>', $txt[151], '</strong></td>';

   echo '
            </tr>';
   
   foreach ($context['topics'] as $topic)
   {
      echo '
            <tr class="windowbg2" id="topic_', $topic['id'], '">
               <td class="smalltext" style="padding-left: 10px; border-bottom: 1px solid rgb(204, 204, 204);">', $topic['board']['link'], '</td>
               <td style="padding-left: 10px; border-bottom: 1px solid rgb(204, 204, 204);">', $topic['link'], '</td>
               <td align="center" class="smalltext" style="border-bottom: 1px solid rgb(204, 204, 204);">', $topic['replies'], '</td>
               <td align="center" class="smalltext" style="border-bottom: 1px solid rgb(204, 204, 204);">', $topic['firstPoster']['link'], '<br />', $topic['firstPoster']['time'], '</td>
               <td align="center" class="smalltext" style="border-bottom: 1px solid rgb(204, 204, 204);">', $topic['lastPoster']['link'], '<br />', $topic['lastPoster']['time'], '</td>
               <td align="center" style="border-bottom: 1px solid rgb(204, 204, 204);"><a href="http://www.bnetweb.org/', $topic['lastPost']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt[111], '" title="', $txt[111], '" /></a></td>
            </tr>';
   }
   
   echo '
         </table>
      </div>';
   
   // Now for all of the javascript stuff
   echo '
      <script language="Javascript" type="text/javascript"><!-- // -->
         var last_post = ', (!empty($context['last_post_time']) ? $context['last_post_time'] : 0), ';
         var time_interval = ', $settings['number_recent_topics_interval'] * 1000, ';
         var max_topics = ', $settings['number_recent_topics'], ';
         
         var interval_id = setInterval( "getTopics()", time_interval);

         function getTopics()
         {
            if (window.XMLHttpRequest)
               getXMLDocument("', $scripturl, '?action=recenttopics;latest=" + last_post + ";xml", gotTopics);
            else
               clearInterval(interval_id);
         }
         
         function gotTopics(XMLDoc)
         {
            var updated_time = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("lastTime")[0];
            var topics = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("topic");
            var topic, id_topic, board, subject, replies, firstPost, lastPost, link;
            var myTable = document.getElementById("topicTable"), oldRow, myRow, myCell, myData, rowCount;
           
            // If this exists, we have at least one updated/new topic
            if (updated_time)
            {
               // Update the last post time
               last_post = updated_time.childNodes[0].nodeValue;
               
               // No Messages message?  Ditch it!
               // Note, this should only happen if there are literally zero topics
               // on the board when a user visits this page.
               if (document.getElementById("no_topics") != null)
                  myTable.deleteRow(-1);
               
               // If the topic is already in the list, remove it
               for (var i = 0; i < topics.length; i++)
               {
                  topic = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("topic")[i];
                  id_topic = topic.getElementsByTagName("id")[0].childNodes[0].nodeValue;
                  if ((oldRow = document.getElementById("topic_" + id_topic)) != null)
                     myTable.deleteRow(oldRow.rowIndex);
               }
               
               // Are we going to exceed the maximum topic count allowed?
               while (((myTable.rows.length - 1 + topics.length) - max_topics) > 0)
                  myTable.deleteRow(-1);
               
               // Now start the insertion
               for (var i = 0; i < topics.length; i++)
               {
                  // Lets get all of our data
                  topic = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("topic")[i];
                  id_topic = topic.getElementsByTagName("id")[0].childNodes[0].nodeValue;
                  board = topic.getElementsByTagName("board")[0].childNodes[0].nodeValue;
                  subject = topic.getElementsByTagName("subject")[0].childNodes[0].nodeValue;
                  replies = topic.getElementsByTagName("replies")[0].childNodes[0].nodeValue;
                  firstPost = topic.getElementsByTagName("first")[0].childNodes[0].nodeValue;
                  lastPost = topic.getElementsByTagName("last")[0].childNodes[0].nodeValue;
                  link = topic.getElementsByTagName("lastLink")[0].childNodes[0].nodeValue;
                 
                  // Now to create the new row...
                  myRow = myTable.insertRow(1);
                  myRow.id = "topic_" + id_topic;
                  myRow.className = "windowbg";
                 
                  // First the Board
                  myCell = myRow.insertCell(-1);
                  myCell.className = "smalltext";
                  myCell.style.paddingLeft = "10px";
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, board);
                 
                  // Then subject
                  myCell = myRow.insertCell(-1);
                  myCell.style.paddingLeft = "10px";
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, subject);
                 
                  // replies
                  myCell = myRow.insertCell(-1);
                  myCell.className = "smalltext";
                  myCell.align = "center"
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, replies);
                 
                  // first post
                  myCell = myRow.insertCell(-1);
                  myCell.className = "smalltext";
                  myCell.align = "center"
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, firstPost);
                 
                  // last post
                  myCell = myRow.insertCell(-1);
                  myCell.className = "smalltext";
                  myCell.align = "center"
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, lastPost);
                 
                  // last post
                  myCell = myRow.insertCell(-1);
                  myCell.align = "center"
                  myCell.style.borderBottom = "1px solid rgb(204, 204, 204)";
                  setInnerHTML(myCell, link);
               }
            }
         }
      // ]]></script>';
Title: Re: AJAX Recent Topics
Post by: synicfan on January 29, 2010, 06:14:10 PM
Quote from: SlammedDime on August 14, 2009, 06:15:39 PM
I've already fixed it for the next version, but due to template changes for 2.0 RC2, a new version won't be released until after that.

does this mean there wont be a SMF2.0 RC2 compatible release?
Are you just going to wait till the next SMF RC is released?

I used your mod on 1.x but Im now using 2.0RC2
thanks!
Title: Re: AJAX Recent Topics
Post by: K4EEO on March 11, 2010, 11:01:23 PM
this seems to work well enough with rc3.. still has the same layout issues as it did with rc2

<div class="navigate_section"> prints out twice.. but i can live with that.

i still wonder why SMF doesn't have this function in the base install.. it seems like an essential feature for any proper forum.
Title: Re: AJAX Recent Topics
Post by: TechPrince on May 02, 2010, 08:30:07 AM
Here is the fixed package for the error mentioned above for RC3

I am facing a different problem, topics are not updating using ajax, IE gave error Message: 'getElementsByTagName(...).0' is null or not an object on the line. Problem is from the Action/SubAction SEF URL Mod.      

var updated_time = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("lastTime")[0];
Title: Re: AJAX Recent Topics
Post by: Arantor on May 02, 2010, 05:24:43 PM
Erm, SlammedDime historically has asked people not to upload edited versions of his mods... you can probably expect him to ask you to remove it...
Title: Re: AJAX Recent Topics
Post by: K4EEO on May 09, 2010, 12:16:13 AM
@ TechPrince.. thanks!
Title: Re: AJAX Recent Topics
Post by: depth on May 10, 2010, 05:07:12 AM
Quote from: Studio1031 on March 11, 2010, 11:01:23 PMi still wonder why SMF doesn't have this function in the base install.. it seems like an essential feature for any proper forum.

I can not agree any more!!!!

/Christian
Title: Re: AJAX Recent Topics
Post by: Arantor on May 10, 2010, 05:51:54 AM
Also don't forget that as forums grow this will get slower and slower and consume more of the server runtime. I dread to think about it running here.
Title: Re: AJAX Recent Topics
Post by: YaPaY on May 14, 2010, 08:10:35 AM
First of all, thank you the coder for great mod.

I'm using this mode with RC3, but I need this mode to convert to last topics instead last post section on home page of my forum.

Is there anybody did this, how?

Thanks,
Title: Re: AJAX Recent Topics
Post by: TechPrince on June 12, 2010, 06:53:24 PM
Action SEF URL's causing incorrect url generation,

getXMLDocument("', $scripturl, '?action=recenttopics;latest=" +last_post+ ";xml", gotTopics);

Action SEF URL = "http://localhost/index.php/action,recenttopics/latest,.html" instead of "http://localhost/index.php/action,recenttopics/latest,123456/xml.html"

Then recent topics will not update due to this issue.
Title: Re: AJAX Recent Topics
Post by: live627 on June 12, 2010, 08:20:43 PM
the xml bit is required methinks
Title: Re: AJAX Recent Topics
Post by: agent47 on September 30, 2010, 05:38:20 PM
I'm using this mod on RC3 and it's working perfectly although since my site is running on Tiny Portal I need to get this display the recent topics on the frontpage. Can someone kindly tell me how that's done, I would greatly appreciate it.
Title: Re: AJAX Recent Topics
Post by: live627 on September 30, 2010, 05:52:22 PM
Grab the code from the mod and paste it in a custom PHP block... I'm not familiar with TP and have no time to look into it ATM
Title: Re: AJAX Recent Topics
Post by: ~DS~ on September 30, 2010, 06:20:54 PM
Dream Portal? Or is it already there? :P
Title: Re: AJAX Recent Topics
Post by: live627 on September 30, 2010, 06:22:34 PM
/me wonders if a DP custom module is implied here
Title: Re: AJAX Recent Topics
Post by: ~DS~ on September 30, 2010, 06:25:55 PM
Quote from: live627 on September 30, 2010, 06:22:34 PM
/me wonders if a DP custom module is implied here
Your mod...into a custom module or better yet already build-in recent topics with ajax enable option. ;)
Title: Re: AJAX Recent Topics
Post by: carinaking on September 30, 2010, 10:48:30 PM
The message time isn't updated correctly - If you don't refresh the recent topics page, the "xx minutes ago" thing doesn't update itself (except for the new topics that popup). Eventually, you'll have a full page with "0 minutes ago". (I know this because I've changed the target of "new post" link to a new window)
_________________
Hence you must select your wedding accessories (http://www.carinadresses.com/wedding-accessories.html) only after selecting the theme of your wedding.
Title: Re: AJAX Recent Topics
Post by: live627 on September 30, 2010, 11:24:06 PM
Let's see. You have Relative Dates installed, right?
Title: Re: AJAX Recent Topics
Post by: SlammedDime on September 30, 2010, 11:38:17 PM
carinaking - this is 'by design' so to speak... I never implemented the code of updating the minutes on the topics... it was one of the less important things in making it work and it would require a slew of javascript to implement... it shouldn't really be hard, just time consuming...
Title: Re: AJAX Recent Topics
Post by: agent47 on October 04, 2010, 08:40:20 AM
Quote from: live627 on September 30, 2010, 05:52:22 PM
Grab the code from the mod and paste it in a custom PHP block... I'm not familiar with TP and have no time to look into it ATM
That's exactly what I did live627, sir but I got this error:
QuoteParse error: syntax error, unexpected '<' in /home/theinfo/public_html/superherocomics.tk/Sources/Load.php(2119) : eval()'d code(48) : eval()'d code on line 1

Can someone please help me out here?
Title: Re: AJAX Recent Topics
Post by: live627 on October 04, 2010, 07:29:27 PM
Looks as if it's not in an echo statement
Title: Re: AJAX Recent Topics
Post by: agent47 on October 05, 2010, 11:44:07 PM
Ok I tried it again and I got no errors but nothing is being displayed although when I goto ?action=recenttopics but I try adding the code to a php block it doesn't seem to work. Can someone PLZ help me out here. I come seeking for it in great desperation?
Title: Re: AJAX Recent Topics
Post by: agent47 on December 02, 2010, 07:39:40 PM
I'm dying for some help here... Please help me out someone... Please? :(
Title: Re: AJAX Recent Topics
Post by: agent47 on December 06, 2010, 07:07:31 PM
Wow so much for a support thread. sheesh
Title: Re: AJAX Recent Topics
Post by: Sakae on December 07, 2010, 12:48:18 PM
Don't worry agent47, I'm sure someday you will get this.

live627, any plans of adding "pagelinks" on list of topics?

Pagelinks:

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg715.imageshack.us%2Fimg715%2F9190%2Fpagelinksclass.jpg&hash=18f72aaef70ff85cd08708678aa1726922adc133) (http://img715.imageshack.us/i/pagelinksclass.jpg/)
Title: Re: AJAX Recent Topics
Post by: SlammedDime on December 09, 2010, 08:07:50 PM
Quote from: agent47 on December 06, 2010, 07:07:31 PM
Wow so much for a support thread. sheesh
You're not asking for support on this mod, your asking support on extending this mod to do things it was not originally made to do.

Quote from: Sakae on December 07, 2010, 12:48:18 PM
live627, any plans of adding "pagelinks" on list of topics?
That would be rather pointless in light of the purpose of this mod...  not to mention the added complexity in live updating
Title: Re: AJAX Recent Topics
Post by: Arkadaş on January 22, 2011, 05:05:50 AM
Recent Topics in this part of the last issues of Hi friends instead of the number of impressions how can we respond.
The number of responses you're not appearing in the picture I want the number of impressions. Thank you in advance for your help

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg34.imageshack.us%2Fimg34%2F7853%2F22471154.jpg&hash=9541aebd3fdb4e5c495eee9993ab8fb29cc5f8ab)
Title: Re: AJAX Recent Topics
Post by: b4pjoe on February 16, 2011, 01:23:49 AM
I've got a small cosmetic issue after I installed this mod. When I click the Recent Topic link it opes the page and everything works...it's just that there are two Link Trees as shown in the attached image. Any idea of a what needs to be fixed?
Title: Re: AJAX Recent Topics
Post by: K4EEO on March 20, 2011, 02:35:33 AM
Quote from: b4pjoe on February 16, 2011, 01:23:49 AM
I've got a small cosmetic issue after I installed this mod. When I click the Recent Topic link it opes the page and everything works...it's just that there are two Link Trees as shown in the attached image. Any idea of a what needs to be fixed?

go back a page or two where i asked about the same issue - TechPrince posted a fix for that ;)
Title: Re: AJAX Recent Topics
Post by: Vahid on April 26, 2011, 09:04:31 AM
hi . i install it and when i try url of this mod it say :

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 17
file: /home/sbclub/domains/shiabloggers.ir/public_html/forum/Sources/Recent.php
line: 1208

i use smf 1.1.13 with persian language . my server detiles :

    Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2
    MySQL client version: 5.0.51a
    PHP extension: mysqli

also MySQL connection collation is utf-general-ci

please guide me about this issue
Title: Re: AJAX Recent Topics
Post by: live627 on April 26, 2011, 08:42:20 PM
What's on lines 1197 - 1208?
Title: Re: AJAX Recent Topics
Post by: Colask8 on June 09, 2011, 08:11:05 AM
can i add this to Tiny Portal somehow? i tried the code from page 9, but it wont work. I use SMF 2.0.5
Title: Re: AJAX Recent Topics
Post by: live627 on June 09, 2011, 07:26:10 PM
SMF 2.0.5 does not exist as of this post.
So, you should be more specific.. If I hear "it doesn't work" I just shrug and move on. How won't it work? What exactly is happening?
Title: Re: AJAX Recent Topics
Post by: agent47 on June 19, 2011, 01:35:20 PM
Any plans on updating this mod for SMF RC5/2.0 ?
My members always found this a very useful feature.
Title: Re: AJAX Recent Topics
Post by: b4pjoe on June 19, 2011, 02:38:07 PM
It is working on SMF 2.0 Final for me. What issues are you having?
Title: Re: AJAX Recent Topics
Post by: agent47 on June 19, 2011, 10:19:00 PM
Quote from: b4pjoe on June 19, 2011, 02:38:07 PM
It is working on SMF 2.0 Final for me. What issues are you having?
Oh it does? I haven't tried it out yet. Thanks for that bro.
Title: Re: AJAX Recent Topics
Post by: qubbah on November 11, 2011, 08:32:22 AM
how can we add a sound?
Title: Re: AJAX Recent Topics
Post by: Zirc on December 03, 2011, 06:02:50 PM
Would it be difficult to add a "New" icon next to the topic subject for topics and replies that are unread?
Title: Re: AJAX Recent Topics
Post by: Guillelmus on January 03, 2012, 11:22:00 AM
Very nice mod. Would it require a lot of changes to the code to show latests posts instead of topics? There was some discussion about this on the first page, but seems the idea was never implemented.
Title: Re: AJAX Recent Topics
Post by: akoladica on January 21, 2012, 04:59:46 AM
Hi, I installed the mod but I changed my mind.
I went to package manager to delete it which I did, but the button "recent posts" and posts are still there.

How can I delete it?
I am not PHP expert

regards
Title: Re: AJAX Recent Topics
Post by: BaghdadGhost on February 20, 2012, 12:55:59 AM
Quote from: akoladica on January 21, 2012, 04:59:46 AM
Hi, I installed the mod but I changed my mind.
I went to package manager to delete it which I did, but the button "recent posts" and posts are still there.

How can I delete it?
I am not PHP expert

regards

use your FTP software or Cpanel file manager and browse to sources/subs.php open and

find and remove

         'recenttopics' => array(
'title' => $txt['recent_topics'],
'href' => $scripturl . '?action=recenttopics',
'show' => true,
'sub_buttons' => array(
),
),



that should remove the button and its content.

Title: Re: AJAX Recent Topics
Post by: BaghdadGhost on February 20, 2012, 01:51:11 AM
Quote from: Guillelmus on January 03, 2012, 11:22:00 AM
Very nice mod. Would it require a lot of changes to the code to show latests posts instead of topics? There was some discussion about this on the first page, but seems the idea was never implemented.

I would like to see this also. and another discussion was left behind which to make this recent posts replace the default smf one.

Title: Re: AJAX Recent Topics
Post by: akoladica on February 20, 2012, 09:25:30 AM
Quote from: BaghdadGhost on February 20, 2012, 12:55:59 AM
Quote from: akoladica on January 21, 2012, 04:59:46 AM
Hi, I installed the mod but I changed my mind.
I went to package manager to delete it which I did, but the button "recent posts" and posts are still there.

How can I delete it?
I am not PHP expert

regards

use your FTP software or Cpanel file manager and browse to sources/subs.php open and

find and remove

         'recenttopics' => array(
'title' => $txt['recent_topics'],
'href' => $scripturl . '?action=recenttopics',
'show' => true,
'sub_buttons' => array(
),
),



that should remove the button and its content.

Thank you for your help.
That worked.
Cheers
Title: Re: AJAX Recent Topics
Post by: akoladica on February 20, 2012, 08:22:17 PM
Hmmm.....now I am not sure if this is working as it should?

For example, when I click on "View the most recent topics on the forum."

I get this message:
"Fatal error: Cannot redeclare RecentTopics() (previously declared in /home/xxx/public_html/forum/Sources/Recent.php:1325) in /home/xxx/public_html/forum/Sources/Recent.php on line 2048"

Is that related?

Or even when I go to some admin parts of the forum I get this error message:
"Fatal error: Cannot redeclare ModifyRecentTopics() (previously declared in /home/xxx/public_html/forum/Sources/ManageSettings.php:2103) in /home/xxx/public_html/forum/Sources/ManageSettings.php on line 2151 "

To many problems I have now.
Title: Re: AJAX Recent Topics
Post by: akoladica on February 22, 2012, 04:53:17 PM
fixed both instances by deleting one of double declared RecentTopics on both occasions.
8)
Title: Re: AJAX Recent Topics
Post by: Zagdul on February 23, 2012, 03:16:51 AM
OK, I hope someone can help me out with this.

I've not modified the mod itself outside a few class changes. I'm having an issue where the action=recenttopics resolves the proper layout, however when I include it into a portal which forces the size of the block, it sorts the table with the oldest on top.

The funny part is, when I'm on action=recenttopics, the recent topics block I've created sorts properly, but when I'm on any other action, it doesn't.

I'm using simple portal to create a custom php block. In the block I've put:

<?php
require_once('/path/to/forums/Themes/default/Recent.template.php');
template_recent();
?>

I have it set to show EVERYWHERE! for testing.

As I said, when I view action=recenttopics, the content in my custom block plus the full page sorts properly, when I view any other action, it sorts in reverse with oldest on top.




Title: Re: AJAX Recent Topics
Post by: SRaven on April 08, 2012, 11:22:28 PM
I would like to use this as a front panel block on the homepage of my forum.  Could someone direct me to what to use for the php block?

I love the layout of this recent topics but I don't want it as a separate page, I want it on my home page replacing my current recent topics block:
http://darkwaters.hostei.com/index.php (http://darkwaters.hostei.com/index.php)  or see pic attachment.
I have tried using
require("Sources/Recent.php");
RecentTopics();

Directing it to use the function that this mod adds to that file but it didn't work.

I use SMF 2.02 and TinyPortal
Any help would be greatly appreciated.

Thanks,
SRaven
Title: Re: AJAX Recent Topics
Post by: BaghdadGhost on April 09, 2012, 12:38:26 AM
we have been waiting for help in this matter  :(

I hope now there are enough requests for some one kind and have a couple of minutes to give it a try lol


Title: Re: AJAX Recent Topics
Post by: Dylert on August 09, 2012, 11:48:37 AM
Hi! I tried to install this mod, but got an error in /Sources/Subs.php What can I do with this?

Kode: (Find) [Chose]

'mlist' => array(
'title' => $txt['members_title'],

Code: (Add before) [Chose]

'recenttopics' => array(
'title' => $txt['recent_topics'],
'href' => $scripturl . '?action=recenttopics',
'show' => true,
'sub_buttons' => array(
),
),
Title: Re: AJAX Recent Topics
Post by: BaghdadGhost on August 11, 2012, 08:10:31 PM
Quote from: Dylert on August 09, 2012, 11:48:37 AM
Hi! I tried to install this mod, but got an error in /Sources/Subs.php What can I do with this?

Kode: (Find) [Chose]

'mlist' => array(
'title' => $txt['members_title'],

Code: (Add before) [Chose]

'recenttopics' => array(
'title' => $txt['recent_topics'],
'href' => $scripturl . '?action=recenttopics',
'show' => true,
'sub_buttons' => array(
),
),


you can do it manually by opening your sub.php and look for

'mlist' => array(
'title' => $txt['members_title'],


then add before

'recenttopics' => array(
'title' => $txt['recent_topics'],
'href' => $scripturl . '?action=recenttopics',
'show' => true,
'sub_buttons' => array(
),
),


this is basically just to determine where you want the button (recent topics) to be in the main menu. if you don't know how to do it, just attach your subs and I will do it for you.

Title: Re: AJAX Recent Topics
Post by: Dylert on August 12, 2012, 07:39:43 AM
Thanks a lot! :)
Title: Re: AJAX Recent Topics
Post by: webbuilder on November 18, 2012, 01:54:31 AM
Using the "ajax recent topics" mod.....it shows 36 topics.......I'd like it to display more...anyone know where I can find that in the code...been searching, can't locate it...

can anyone advise
Title: Re: AJAX Recent Topics
Post by: live627 on November 18, 2012, 02:47:31 AM
Admiin > Features and Options > Modification > Recent Topics
Title: Re: AJAX Recent Topics
Post by: Dylert on March 21, 2013, 08:45:31 PM
Great mod! Thanks a lot!
I'm also looking for a block-code for this. Has anyone managed to make one?? :)
What about the new.gif image. It will be easier to see that there is a new post with that image added. Maybe it can be added manually by editing some code? Anyone?? :)
Title: Re: AJAX Recent Topics
Post by: Dblog on March 26, 2013, 09:30:18 AM
is there anyway to remove repeat of breadcrumbs and add no. of views of each topic into the table.
also in admin cp, ?action=recenttopics is not seen as an action
only ?action=recent and others are seen
Title: Re: AJAX Recent Topics
Post by: lfep on April 21, 2013, 09:15:10 AM
I installed this mod and the recent topics page works very well but I don't find an easy way to embed this mod it in the Info Center of SMF. Is there a step by step instruction how to do this.
Thank you in advace!

Title: Re: AJAX Recent Topics
Post by: Dhayzon on August 10, 2013, 03:06:26 PM
why not show new icon post  image?
Title: Re: AJAX Recent Topics
Post by: sanchitseo on September 17, 2013, 02:04:13 AM
Thank you for the mod... but how it exactly works.. m not able to use...
Title: Re: AJAX Recent Topics
Post by: Dylert on September 17, 2013, 02:23:12 AM
The installation went well, but recents topics won't show up. I get this message: http://hellasforum.net/index.php?action=recenttopics
What can be wrong? Something with the database or settings???
Title: Re: AJAX Recent Topics
Post by: live627 on September 19, 2013, 01:53:10 AM
Screenshot please.
Title: Re: AJAX Recent Topics
Post by: Martin_78_NOR on January 03, 2014, 07:52:45 PM
We use this, but after installing the instant quick reply we would like to increase the list of recent posts shown from 15 (today) to say 20.... how do we do that ?

Thanks for a great mod :)
Title: Re: AJAX Recent Topics
Post by: live627 on January 04, 2014, 01:49:23 PM
Admin > Modifications > Recent Topics
Title: Re: AJAX Recent Topics
Post by: Martin_78_NOR on January 04, 2014, 01:53:00 PM
THX!
Title: Re: AJAX Recent Topics
Post by: mikev on February 22, 2014, 06:31:28 PM
Is there a way for page numbers to show up and be clickable on multiple page topics when recent topics are shown?

Alternatively, is there a way to make clicking the thread title go to the last post instead of the first one?
Title: Re: AJAX Recent Topics
Post by: wolf39us on April 01, 2014, 10:04:01 PM
I'm having a bit of trouble because I'm new to SMF (coming from PHPbb3).  I'm looking to add an additional button beside the "last unread post" icon for the actual last reply.  My users miss the function in PHPbb3 that allowed them to skip to the very end of the topic.

I found this bit in "Recent.template.php"

               <td align="center" style="border-bottom: 1px solid rgb(204, 204, 204);"><a href="', $topic['lastPost']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt['last_post'], '" title="', $txt['last_post'], '" /></a></td>

I've tried all different variations with a href=", $topic['lastPost'] by just changing the reference to say 'newPost' or something to that effect, but I've been unable to figure out which variable to use.

I've done a tone of Google searching and haven't come across what I need... can someone help please?
Title: Re: AJAX Recent Topics
Post by: iain sherriff on May 11, 2014, 08:14:02 AM
I have a group of members that can only see a verification board/topics.
Is there a way they can see the Recent topics list showing all topics (not just ones the specific group can see) to be a taster of what is available after verification

Thanks
Title: Re: AJAX Recent Topics
Post by: vkmaxx on June 08, 2014, 10:52:12 AM
I have a problem, navigation bar is displayed two times, do you know how to fix it?

Link: http://www.raceroom.pl/index.php?action=recenttopics
Pic:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FP1ts7ivl.png&hash=6a580f7d8b6615cb1420780b55faf920e5c1f9d6) (http://imgur.com/P1ts7iv)
Title: Re: AJAX Recent Topics
Post by: lester-cat on June 14, 2014, 02:58:26 PM
same problem :(
Title: Re: AJAX Recent Topics
Post by: vkmaxx on June 22, 2014, 05:52:21 AM
up (?)
Title: Re: AJAX Recent Topics
Post by: jondiez on February 25, 2015, 12:23:16 PM
Is it possible to exclude a board from the results?
Title: Re: AJAX Recent Topics
Post by: samborabora on April 27, 2015, 10:32:23 AM
Is it possible to modify this to bring up recent posts instead of just topics?
Title: Re: AJAX Recent Topics
Post by: Jade Elizabeth on April 28, 2015, 07:16:01 AM
Hey I just installed this and it gave me the fatal errors for redeclaring as well on the recent.php and managesettings.php files. For some reason the steps were duplicated. Could it possibly be a mod thing? I was on 2.0.9 at the time, but I can't see anything duplicated with the SMF parser....but the fact that people are getting it on the same files does raise some questions :). It also didn't remove the duplications.

EDIT: Also duplicated the templates...I will have to look through all the files and make sure they're ok...

EDIT 2: It duplicated on all changes. The package file seems to be okay, don't know why this is happening to some of us.
Title: Re: AJAX Recent Topics
Post by: Mimmi on October 26, 2015, 06:46:51 AM
Thank you for this mod!

Here is a Norwegian translation.
<?php
// Version: 2.0; Modifications
// AJAX Recent Topics
$txt['recent_topics'] = 'Siste emner';
$txt['minutes_ago'] = ' minutter siden';
$txt['number_recent_topics_interval'] = 'Tidsforsinkelse (i sekunder) mellom sjekk for oppdaterte emner.';
$txt['number_recent_topics_interval_desc'] = 'Ikke for lavt, 5-10 sekunders forsinkelse er passe.';
$txt['number_recent_topics'] = 'Emner som skal vises på siden for Siste emner';

?>
Title: Re: AJAX Recent Topics
Post by: CMOBOSS on December 11, 2016, 09:23:49 AM
There seems to be an issue with the install on 2.0.12.

subs.php modification

find                       'mlist' => array(
            'title' => $txt['members_title'],

Fails.

For some reason even copying the complete snippet and searching manually results in 0.

Searching for the two individually shows code is accurate, and I can find boths lines no problem.

Here's the thought. There is only one     'mlist' => array(     In subs.php   so why not search for that in the xml, only, for the add before...

'recenttopics' => array(
            'title' => $txt['recent_topics'],
            'href' => $scripturl . '?action=recenttopics',
            'show' => true,
            'sub_buttons' => array(
            ),
         ),

I have installed other packages with no problems. but this one threw an error on install.

I did the manual changes and the package works. Just thought maybe someone would like to update this. Of course... I am not even sure if the new beta has this available in the core... ???? So maybe I'm just wasting my time. lol
Title: Re: AJAX Recent Topics
Post by: JohnA on December 26, 2017, 09:54:44 PM
I am having the same double nav error vkmaxx at the top of the ?action=recenttopics described above.  Does anybody know the fix for this.  I really like this mod, but I would really like to remover that double instance of the navigation links.  I'd appreciate any help/guidance.
Title: Re: AJAX Recent Topics
Post by: jsx on February 24, 2019, 09:38:32 AM
@live627

I have clean SMF 2.0.15 forum. And when I want to install this modification, I get an error:

QuoteError in Package Installation
At least one error was encountered during a test installation of this package. It is strongly recommended that you do not continue with installation unless you know what you are doing, and have made a backup very recently. This error may be caused by a conflict between the package you're trying to install and another package you have already installed, an error in the package, a package which requires another package that you don't have installed yet, or a package designed for another version of SMF.

Execute Modification > ./Sources/Subs.php > Test failed
Add Before > ./Sources/Subs.php > Test failed

Code: (Find)

'mlist' => array(
'title' => $txt['members_title'],


Code: (Add Before)

'recenttopics' => array(
'title' => $txt['recent_topics'],
'href' => $scripturl . '?action=recenttopics',
'show' => true,
'sub_buttons' => array(
),
),


Why is this happening?
Title: Re: AJAX Recent Topics
Post by: Boggi on March 18, 2020, 12:03:24 AM
Quote from: vkmaxx on June 08, 2014, 10:52:12 AM
I have a problem, navigation bar is displayed two times, do you know how to fix it?

In Recent.template.php delete code:

echo '
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td>', theme_linktree(), '</td>
</tr>
</table>';
Title: Re: AJAX Recent Topics
Post by: Kira_ on February 19, 2022, 06:39:07 AM
Fork for 2.1. Ноокs only.

Edit by Gary: attachment removed for license violation
Title: Re: AJAX Recent Topics
Post by: jsx on September 02, 2022, 04:13:03 AM
A request to the mod's author to consider updating the mod for SMF 2.1
Title: Re: AJAX Recent Topics
Post by: live627 on September 29, 2022, 05:26:21 AM
Quote from: Kira_ on February 19, 2022, 06:39:07 AMFork for 2.1. Ноокs only.

Edit by Gary: attachment removed for license violation
Hi! Can you please send it as a pull request to https://github.com/live627/ajax_recent_topics
Title: Re: AJAX Recent Topics
Post by: @rjen on September 29, 2022, 06:14:30 AM
I have made a new package for 2.1 as well... I can send a PR if you want to incorporate it...
Title: Re: AJAX Recent Topics
Post by: @rjen on September 29, 2022, 08:14:54 AM
There you go..

https://github.com/live627/ajax_recent_topics/pull/1
Title: Re: AJAX Recent Topics
Post by: jsx on October 03, 2022, 08:16:55 AM
When can expect the mod to be updated on the mods page?

Title: Re: AJAX Recent Topics
Post by: jsx on October 12, 2022, 09:16:49 AM
@live627

Are you going to share this release from github? It's been a while since rjen made this package.
Title: Re: AJAX Recent Topics
Post by: jsx on January 01, 2023, 07:02:23 AM
Hello @live627

Will you provide an official update of this mod in the simplemachines modification database?
Title: Re: AJAX Recent Topics
Post by: gevv on September 08, 2023, 03:59:20 PM
Quote from: @rjen on September 29, 2022, 08:14:54 AMThere you go..

https://github.com/live627/ajax_recent_topics/pull/1

Hi @rjen

error message appears

Fatal error: Cannot redeclare template_recent() (previously declared in C:\wamp64\www\smf\Themes\default\Recent.template.php:16) in C:\wamp64\www\smf\Themes\default\Recent.template.php on line 430
Title: Re: AJAX Recent Topics
Post by: @rjen on September 08, 2023, 04:08:32 PM
You are not giving any background on what you did, forum version, mod version or whatever.

Nothing I can tell you without any background
Title: Re: AJAX Recent Topics
Post by: gevv on September 08, 2023, 04:37:17 PM
Sorry,

SMF 2.1.4

i use; https://github.com/live627/ajax_recent_topics/archive/refs/heads/master.zip
Title: Re: AJAX Recent Topics
Post by: @rjen on September 08, 2023, 04:40:18 PM
Okay, so you are using the original mod and not my version?

If you want to use my version you need to uninstall the original one first and then install the updated. The mod author never incorporated mij changes in the original mod as far as i know
Title: Re: AJAX Recent Topics
Post by: gevv on September 08, 2023, 04:42:27 PM
Can you give the link to your version?
Title: Re: AJAX Recent Topics
Post by: gevv on September 08, 2023, 04:46:22 PM
I found it :) sorry, I'm ignorant of github :)

https://github.com/Bopske/ajax_recent_topics

Thanks.

Is there a way to fix the mobile view issue?
Title: Re: AJAX Recent Topics
Post by: gevv on September 09, 2023, 06:54:11 AM
Hi,

Hide  board and replies information on mobile. Looks better now. Thanks @@rjen

Recent_top.template.php

@media (max-width: 1024px) {
.nno {
display: none;
}

}


mobilenone.png



Title: Re: AJAX Recent Topics
Post by: @rjen on September 09, 2023, 07:17:24 AM
I added the hiddensmall class for that...
Title: Re: AJAX Recent Topics
Post by: jsx on September 10, 2023, 07:10:22 AM
@@rjen I understand that I can download this mod from your github, but why this mod is not available in the mod database on simplemachines website?
Title: Re: AJAX Recent Topics
Post by: @rjen on September 10, 2023, 10:01:12 AM
Because it is not mine to publish. I submitted my updates for the mod author to incorporate.

But if he/she does not incorporate them I have no option to publish it
Title: Re: AJAX Recent Topics
Post by: jsx on September 10, 2023, 11:43:21 AM
@@rjen I understand.

@live627 it would be nice if you would make this updated mod available on the simplemachines site.
Title: Re: AJAX Recent Topics
Post by: live627 on September 10, 2023, 07:24:30 PM
Quote from: jsx on September 10, 2023, 11:43:21 AM@live627 (https://www.simplemachines.org/community/index.php?action=profile;u=154736) it would be nice if you would make this updated mod available on the simplemachines site.
I'm working on the long-awaited update now.
Title: Re: AJAX Recent Topics
Post by: jsx on September 11, 2023, 12:37:06 PM
This is good news. Would you be willing to add a feature to this mod so that it's possible to place the Recent Topics button anywhere on the menu bar, if possible? Currently, the Recent Topics button appears after the Search button. I know that in the code in the Subs-RecentTopics.php file, can change the position of the Recent Topics button so that it doesn't appear after the Search button. I suggested this to you because perhaps you could create such a feature.
Title: Re: AJAX Recent Topics
Post by: gevv on September 11, 2023, 01:51:48 PM
Hi,

@jsx Good idea for customization.

@live627 Mod update is a great effort.

Adding a menu order can be time consuming and complex. This delays the new version of the mod  ;D

A simple solution; Edit the Subs-recent_top.php file. Line 34 change "search" admin, moderate or mlist

bname.png
Title: Re: AJAX Recent Topics
Post by: live627 on September 12, 2023, 04:04:37 AM
At long last, the much awaited update is here!

2.0.0 (2023-09-12)

⚠ BREAKING CHANGES

    drop support for SMF 1.1.x
    Require PHP >= 7.1

Features

    Add support for SMF2.1 (#1) (b11a7c2)

Code Refactoring

    drop support for SMF 1.1.x (1149b7c)
Title: Re: AJAX Recent Topics
Post by: jsx on September 12, 2023, 05:10:20 AM
After installing this mod and entering Recent Topics, an error is displayed:

Unable to load the 'recent' template.

P.S. Look at your first post on this topic, bbcode is not showing in this post.
Title: Re: AJAX Recent Topics
Post by: IP_Board_Rules on September 12, 2023, 12:39:37 PM
Is there a live demo of this mod?
Title: Re: AJAX Recent Topics
Post by: jsx on September 12, 2023, 03:13:50 PM
I have another suggestion for the future development of the Recent Topics mod:

I think it would be nice if in Permissions, it were possible to block access to Recent Topics for guests.
Title: Re: AJAX Recent Topics
Post by: live627 on September 13, 2023, 06:44:07 AM
I sent up a new bugfix release to this mishap.
Title: Re: AJAX Recent Topics
Post by: Daretary on November 01, 2023, 10:37:36 AM
I'm sorry, but I would like to suggest an improvement for your mod.

1. It is more convenient to switch to a new tab so that the page with the Ajax update remains accessible.
RecentTopics.php
[CDATA[<a href="', $topic['lastPost']['href'], '" class="new_posts">' . $txt['new'] . '</a>]replaced by
[CDATA[<a href="', $topic['lastPost']['href'], '" class="new_posts" target="_blank">' . $txt['new'] . '</a>]RecentTopics.template.php
<a href="', $topic['lastPost']['href'], '"><i class="main_icons last_post"></i></a>replaced by
<a href="', $topic['lastPost']['href'], '" target="_blank"><i class="main_icons last_post"></i></a>
2. For even greater clarity, when moving to a new message, it is better to automatically change the icon to last_post.
RecentTopics.template.php
            echo '
                    <tr class="windowbg" id="topic_', $topic['id'], '">
replaced by
            echo '
                    <script>$(document).ready(function(){$(document).on("click",".new_posts",function(s){s.preventDefault(),$(this).hasClass("processed")||($(this).removeClass("new_posts").addClass("processed"),$(this).html(\'<i class="main_icons last_post"></i>\'),s=$(this).attr("href"),window.open(s,"_blank"))})});</script>
                    <tr class="windowbg" id="topic_', $topic['id'], '">
Title: Re: AJAX Recent Topics
Post by: jonathancph on January 23, 2024, 05:33:54 PM
is it possible to add pagination to this great mod ?
Title: Re: AJAX Recent Topics
Post by: Chalky on April 17, 2024, 01:58:02 AM
This will do the job very nicely - thank you!!