How to modify Similar Topic?

Go down

Solved How to modify Similar Topic?

Post by Mr. Ganesha on April 28th 2015, 11:40 am

Can I modify "Similar Topics" box, not to show "external link" but It will show my Topic Links related with the Topic Title.



Last edited by Mr. Ganesha on April 29th 2015, 4:19 pm; edited 1 time in total
avatar
Mr. Ganesha
Forumember

Male Posts : 96
Reputation : 2
Language : Bahasa
Location : Medan, Indonesia

http://laskarislam.com/

Back to top Go down

Solved Re: How to modify Similar Topic?

Post by JScript on April 28th 2015, 12:25 pm

@Mr. Ganesha

Yes, test the code below with placement only "In the topics":
Code:

// JScript
// Similar topics
// PHPBB3
$(function() {
   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 = '';
   //console.log(1, 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);
   //console.log(2, 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
avatar
JScript
Forumember

Male Posts : 741
Reputation : 173
Language : PT-BR, EN
Location : Brazil

http://jscript.forumeiros.com/

Back to top Go down

Solved Re: How to modify Similar Topic?

Post by Mr. Ganesha on April 29th 2015, 4:19 pm

Yea, It works, thank you @JScript Smile
avatar
Mr. Ganesha
Forumember

Male Posts : 96
Reputation : 2
Language : Bahasa
Location : Medan, Indonesia

http://laskarislam.com/

Back to top Go down

Solved Re: How to modify Similar Topic?

Post by Ange Tuteur on April 29th 2015, 10:37 pm

Thanks for the help, JScript.

Topic archived
avatar
Ange Tuteur
Forumaster

Male Posts : 13202
Reputation : 2918
Language : EN10, FR5, JA5
Location : Macungie, PA

https://github.com/SethClydesdale

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum