The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

How to modify Similar Topic?

View previous topic View next 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

Mr. Ganesha
Forumember

Male Posts : 95
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

JScript
Forumember

Male Posts : 741
Reputation : 167
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

Mr. Ganesha
Forumember

Male Posts : 95
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

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


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