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.

Classified Ads: Links in Description

View previous topic View next topic Go down

Solved Classified Ads: Links in Description

Post by SLGray on June 13th 2017, 4:15 am

Technical Details


Forum version : #ModernBB
Position : Founder
Concerned browser(s) : Mozilla Firefox
Who the problem concerns : All members
When the problem appeared : Since the classified ads feature was released.
Forum link : http://ztwds.forumotion.com/

Description of problem

Is there a way to add links to the description of classified ads?
avatar
SLGray
Administrator
Administrator

Male Posts : 39578
Reputation : 2655
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

Solved Re: Classified Ads: Links in Description

Post by Justice™ on June 13th 2017, 12:13 pm

I think you should be able to add links using this code:
Code:
<a href="link">Text</a>
Make sure HTML is enabled on your forum.
avatar
Justice™
Forumember

Posts : 481
Reputation : 113
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Classified Ads: Links in Description

Post by SLGray on June 13th 2017, 5:58 pm

HTML or BBCode does not work.


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.

avatar
SLGray
Administrator
Administrator

Male Posts : 39578
Reputation : 2655
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

Solved Re: Classified Ads: Links in Description

Post by Justice™ on June 13th 2017, 7:07 pm

I think that the description only accepts text. Fortunately, this can be changed via javascript. I cannot create ads on my forum(for reasons I'm not going to explain here), so I'll need a link from your forum where I can see the description of a classified add. It would be helpful if you would add this code to that description:
Code:
<a href="www.google.com">Google</a>
avatar
Justice™
Forumember

Posts : 481
Reputation : 113
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Classified Ads: Links in Description

Post by SLGray on June 13th 2017, 8:30 pm



When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.

avatar
SLGray
Administrator
Administrator

Male Posts : 39578
Reputation : 2655
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

Solved Re: Classified Ads: Links in Description

Post by Ange Tuteur on June 14th 2017, 7:18 pm

Hi @SLGray,

Go to Admin Panel > Modules > JS Codes management > New

Placement : In all the pages ..? (I'm not sure if "in the topics" is applicable here)
Code:
$(function() {
  // parses hyperlinks in classified ad descriptions
  for (var a = $('.AD_Description'), i = 0, j = a.length; i < j; i++) {
    a[i].innerHTML = a[i].innerHTML.replace(/(http(?:s|):\/\/.*?)(\s|&nbsp;|<br>|$)/ig, function (match, $1, $2) {
      return '<a class="AD_Description_Link" href="' + $1 + '" target="' + ( new RegExp(window.location.host).test($1) ? '_self' : '_blank' ) + '">' + $1 + '</a>' + $2;
    });
  }

  'par ange tuteur';
});

It should automatically parse text which begins with http or https as links. If any issues, let me know.
avatar
Ange Tuteur
Forumaster

Male Posts : 13174
Reputation : 2872
Language : EN10, FR5
Location : Macungie, PA

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Classified Ads: Links in Description

Post by SLGray on June 14th 2017, 9:00 pm

Thanks @Ange Tuteur! It worked perfectly.

Problem solved & topic archived.
Please read our forum rules: ESF General Rules


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.

avatar
SLGray
Administrator
Administrator

Male Posts : 39578
Reputation : 2655
Language : English
Location : United States

https://fmthemes.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