Table style override

Table style override 1.0.0

Vous n'avez pas l'autorisation de télécharger
Compatibilité XF
  1. 2.3.x
Description courte
Enhance your XenForo 2.3 posts with custom tables using this addon. Fix broken custom bbcode formatting by updating DB queries and intercepting built-in code for a niche solution that teaches valuable coding skills.
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"]
[TR="bgcolor=grey"]
[TD="text-align:left,font-weight:bold"]
...
... 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:

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

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.
plug1.webp
plug2.webp
plug3.webp
Auteur
axtona
Vues
18
Type d’extension
zip
Taille du fichier
11.3 Ko
Première publication
Dernière mise à jour
Évaluations 0.00 étoile(s) 0 évaluations
Lien cassé ? Envoyer un message à l’équipe NP et nous vous aiderons rapidement !
Soutenez le développeur Si vous êtes satisfait du test ou que votre projet vous a rapporté de l’argent, cliquez sur le bouton « Plus d’informations » pour soutenir le développeur en achetant.

Plus de ressources de axtona

XFRM SEO Boost A
Make every resource page count — for search engines, social sharing, and your readers.
ForumBot AI A
ForumBot AI 1.0.5 Untouched
ForumBot vous donne un bot entraîné sur le contenu de votre propre forum
 Blogs A
Blogs 1.7.5
Donnez à vos utilisateurs une façon de s'exprimer davantage dans leur propre espace personnel!

Ressources similaires

[AndyB] Remove style variation system A
Removes style variation 'system' from selection options.
[AndyB] Prefix style manager A
This add-on is useful if you would like to define your own thread prefix background color.
Haut