YAFLogo

JP
  • JP
  • 100% (Exalted)
  • YAF Leader Topic Starter
5 years ago
This is a very basic question indeed, but I need help to make a basic custom BBCode for my forum...

I have tried myself, but since I'm too stupid to figure it out - I even managed to mess up quoting in the forum... 😊 😁

What I want to do is to refer to an external product link from a product id within the BBCode tags...

Like this:


[product]37017[/product]
Should act like:
<a href="http://www.company.com/products/lawnmowers/37017">37017</a>

The product id could be like "3701", "B126-2", "RC3514" as examples...

Any help would be very much appreciated indeed...

I have never done this, and I suck on RegEx so I would need the Search & Replace Regexes as well as additional info regarding the fields to fill in when in the Add BBcode dialog...


He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Old Chinese Proverb]
Sponsor

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 3.0.3
5 years ago
The easiest way would be to check existing BB Code Extension to see how it works.

Ok what you need is

Search Regex...

\[product\](?<inner>.*?)\[/product\]

and Replace Regex

<a href="http://www.company.com/products/lawnmowers/${inner}">${inner}</a>