FM Themes
Welcome to FM Themes
where you can share your ModernBB, punBB, phpBB 2, Invision, & phpBB 3 themes for Forumotion forums.

You are viewing the forum as a guest, so you will not be able to use the full forum. To use all the features of the forum, you need to log in or create a FREE account by registering.
Share
View previous topicGo downView next topic
avatar
Posts : 15
Points : 308
Reputation : 4
View user profile

Similar Topics

on Mon Apr 27, 2015 8:00 pm
Message reputation : 100% (1 vote)
Similar Topics
Hello everybody, I saw this topic [You must be registered and logged in to see this link.] and it occurred to me this idea: Similar Topics
But I only tested in the phpbb3 version of the help forum! I'm out of time now to make it compatible with other versions, if any of you have time for that, I thank you!

Here's the code:
Code:

// JScript
// Similar topics
// PHPBB3
// Date: 2015-04-27
//
var iAmount = 5;
// It is important to know that some people write wrong and often do not accentuate the letters,
// then search for words without the accent is much better!
// Not to mention that the title will be functional in all versions!!!
var aTitle = location.pathname.replace(/-/g, ' +').split(' ').slice(1);
var sTitle = '';
[You must be registered and logged in to see this link.] aTitle);
// Important: delete words containing less than 4 characters to search!
// With this we avoid searching for words like: one, and, of ...
jQuery.each(aTitle, function(index, data) {
 if (data.length > 4) {
 sTitle += data;
 }
});
sTitle = sTitle.substr(1);
[You must be registered and logged in to see this link.] sTitle);

// Tested in PHPBB3 version!
var memDiv = jQuery('<div>');
memDiv.load('/search?search_keywords=' + sTitle + ' .forabg', function() {
 memDiv.find('dt').text('Similar Topics');
 var oTopics = memDiv.find('.topiclist > .row');
 oTopics[0].remove();
 oTopics.slice(iAmount + 1, oTopics.length).remove();
 if (oTopics.length) {
 memDiv.insertAfter('.topic-actions:last');
 }
});

Result:


So long,

JS
Written by JScript
avatar
Administrator
Posts : 3923
Points : 1814
Reputation : 311
View user profilehttps://www.fmthemes.net

Re: Similar Topics

on Sun Jun 07, 2015 10:58 pm
Message reputation : 100% (1 vote)
[You must be registered and logged in to see this link.]

Since this does work on phpBB 3, I am going ahead and approve it.  If you are going to make it work on all four versions you can add to the topic.
avatar
Posts : 15
Points : 308
Reputation : 4
View user profile

Re: Similar Topics

on Mon Jun 08, 2015 2:09 pm
Ok friend, thank you!

I'm finishing another code and then I will finish this.

JS
avatar
Administrator
Posts : 3923
Points : 1814
Reputation : 311
View user profilehttps://www.fmthemes.net

Re: Similar Topics

on Tue Jun 09, 2015 2:31 pm
Message reputation : 100% (1 vote)
[You must be registered and logged in to see this link.] wrote:Ok friend, thank you!

I'm finishing another code and then I will finish this.

JS
Thanks for the update. I will move it to correct section when you add the other information.
View previous topicBack to topView next topic
Permissions in this forum:
You cannot reply to topics in this forum