Resource icon

Custom BB Code Manager v1.3.4

No permission to download
I'm trying to create bbcode to use html anchors in a page. The problem is when creating the link to the ancor, the bbcode is like this:
Code:
[GOTO=anchorname]link text[/GOTO]

and is replaced this way:
Code:
<a href="#%s">link text</a>

It works because in the post the html code result is:
<a href="#anchorname">link text</a>

The problem is that xenforo parses the url and when you click redirects you to this url: http://xenforourl/#anchorname

I had this working in vb and it's very annoying because we have several articles that use this bbcode.
 
Hi, we're getting a ton of garbage queries from this addon.

5kCI3.png


Any idea why this would be the case?
 
Th issue is if the the text is [bbcode]link[/bbcode] but not if it is [/bbcode]link [/bbcode] That space is very important

Any solution to this?
 
Hi! I've just started to use the addon and have some suggestions:
Now every tag-render generates db query, so if my post will have 100 tags there will be 100 queries.
It is possible to store tags in simpleCache or get them in pre_view event by one query.
Other suggestion is to automatically or optionally add buttons to editor when bbcode is created.
BTW, do you have github?
I am using the "Double Post Merge" addon by Syndol, and for every double post merged, this addon creates 2 queries. Besides this, every spoiler creates one DB query. The Addon itself has 2 queries already, the number ofqueies is just baffling, any solution to this?

I've already posted a temporary fix for this. See here.

First thank you for sharing this add-on ...

I tired to create a custom BB code to align images left and right ... but it didn't work ..

Here is the codes that I used :
Simple Replacement Start:
Code:
<img class="alignleft" border="0" alt="" src="
Simple Replacement End:
Code:
" />
but it didn't work ..
any help is appreciated to sort it out .. thank you

See the problem here ; for a fix, see here (function 4).
 
I'm trying to create bbcode to use html anchors in a page. The problem is when creating the link to the ancor, the bbcode is like this:
Code:
[GOTO=anchorname]link text[/GOTO]

and is replaced this way:
Code:
<a href="#%s">link text</a>

It works because in the post the html code result is:


The problem is that xenforo parses the url and when you click redirects you to this url: http://xenforourl/#anchorname

I had this working in vb and it's very annoying because we have several articles that use this bbcode.
You have to create a bbcode with a PHP Callback. Then you should do what you want to do using php.

There is an issue when using this addon with this:http://xenforo.com/community/resources/automatic-url-aliases-automatic-url-conversion.493/.
Here is the error: http://xenforo.com/community/attachments/30706/
Using the addon with any of the XF BBCodes, there is no error.

Any solution?

This error is neither coming from this addon, nor coming from Ragtek addon. The problem is XenForo doesn't deal with custom tags yet. So if you insert an url inside a custom tag inside, when the Ragtek addon call the XenForo parse url function, the closing tag will part of the url. To fix this, you have to edit the Ragtek addon:
Code:
\library\Ragtek\PLEL\Formatter\BbCodeAutolink.php

Search:
Code:
        $link = XenForo_Helper_String::prepareAutoLinkedUrl($url);

Add below:
Code:
    $link['url'] = preg_replace('#\[.*?\]#', '', $link['url'] );

Then it will work.
 
Oops i've checked and my fix delete the ending closing tag during the parsing ^^ It can be corrected, but the Regtek function needs to be modified more.
 
Let's do it again. It's not the cleanest way to do it, but it's the easier way for editing ^^
In:
Code:
\library\Ragtek\PLEL\Formatter\BbCodeAutolink.php

Search:
Code:
        $link = XenForo_Helper_String::prepareAutoLinkedUrl($url);
Replace:
Code:
        $link = XenForo_Helper_String::prepareAutoLinkedUrl($url);
 
    $closingTag = '';
    if(preg_match('#\[/.*?\]#', $link['url'], $capture))
    {
        $closingTag = $capture[0];
        $link['url'] = str_replace($closingTag, '', $link['url']);
        $link['linkText'] = str_replace($closingTag, '', $link['linkText']);
    }

Search:
Code:
                return $tag . $link['suffixText'];
Replace:
Code:
        return $tag . $link['suffixText'] . $closingTag;
 
Sorry, you said it is not the cleanest, if it isn't too much trouble, I'd rather use the cleaner but harder way.
 
Don't worry ^^ I would have prefer to add a conditional (if(isset($closingTag)){...}else{}) to make two kinds of "function return", but the result will be the same ;)
Use the above code, it will work fine.
 
Let's do it again. It's not the cleanest way to do it, but it's the easier way for editing ^^

Search:
Code:
        $link = XenForo_Helper_String::prepareAutoLinkedUrl($url);
Replace:
Code:
        $link = XenForo_Helper_String::prepareAutoLinkedUrl($url);
 
    $closingTag = '';
    if(preg_match('#\[/.*?\]#', $link['url'], $capture))
    {
        $closingTag = $capture[0];
        $link['url'] = str_replace($closingTag, '', $link['url']);
        $link['linkText'] = str_replace($closingTag, '', $link['linkText']);
    }

Search:
Code:
                return $tag . $link['suffixText'];
Replace:
Code:
        return $tag . $link['suffixText'] . $closingTag;
could you explain this?*g* what's the deal with the closing
 
Top Bottom