We have detected that you are using AdBlock.

Please disable it for this site to continue.

  • All Passwords for this resource will be in "Updates" tab below.

    We only publish files for testing purpose. Consider buying licenses to support original developers.

Resource icon

Table style override 1.0.0

Compatible XF 2.x versions
  1. 2.3
Visible branding
No
After upgrading from XF 1.5, I had more than 1100 threads that used a custom bbcode to make tables. They looked like this:

Code:
[TABLE="width:800px,text-align:center"]<br>[TR="bgcolor=grey"]<br>[TD="text-align:left,font-weight:bold"]<br>...<br>... etc ... etc

Well, the built in TABLE bbcode did not handle that at all, and the raw text (no formatting at all) just showed in these threads. None of the table bbcodes i found could be easily switched to without manually updating a thousand+ posts, or writing a complicated program to convert all the bbcodes to a different format.

So, I wrote the attached code. Now, because of how XF 2.3 treats bbcodes, the [TABLE="xxx"] and [TD="xxx"] just wouldnt work. So I had to do a couple of DB queries to change these.

SQL:
<span>UPDATE</span> xf_post<br><span>SET</span> message <span>=</span> <span>REPLACE</span><span>(</span>message<span>,</span> <span>'[TABLE='</span><span>,</span> <span>'[TABLE STYLE='</span><span>)</span><br><span>WHERE</span> message <span>LIKE</span> <span>"%[TABLE=%"</span><span>;</span><br><br><span>UPDATE</span> xf_post<br><span>SET</span> message <span>=</span> <span>REPLACE</span><span>(</span>message<span>,</span> <span>'[TD='</span><span>,</span> <span>'[TD STYLE='</span><span>)</span><br><span>WHERE</span> message <span>LIKE</span> <span>"%[TD=%"</span><span>;</span>

Then i wrote an addon to handle the above. Funny enough, I had to leave the [TR="xxx"] code as it was, as switching it to the same format as the above didnt help.

So, this is VERY niche, and probably not very helpful to anyone. BUT, it does show how to intercept and override the built-in
code, and I hope that it has good educational value.

The screenshots show some sample bbcode, then a rendered table (which only renders at all because of the SQL changes) without the plugin enabled, and finally the same post with the plugin enabled.
Author
kashif
Downloads
20
Views
1,118
First release
Last update

Ratings

0.00 star(s) 0 ratings

More resources from kashif

Top
Live activity
Just now · VUInsider.com