BBCode multiple problems

Get help with installation and running phpBB 3.2.x here. Please do not post bug reports, feature requests, or extension related questions here.
Post Reply
Nethar
Registered User
Posts: 6
Joined: Mon Feb 06, 2017 10:13 pm

BBCode multiple problems

Post by Nethar » Mon Feb 06, 2017 10:35 pm

After update do PHPBB 3.2.0 I have multiple problems with custom BBCode. I am happy to provide more information for each of them if necessary.

1) It seems that two codes like

Code: Select all

[custom]{TEXT}[/custom]

Code: Select all

[custom={NUMBER}]{TEXT}[/custom]
do not work anymore, makes that both disabled. I have to delete one of them to make it run.

2) I modified the BBCodes to make it run at least without attributes (problem (1) above). All the old forum posts are still invalid - they contain BBCode source, not its output. When I edit the post, the preview is ok, I save the post and it is ok then. But I cannot go through all the old posts to update them. Is there any simple way to refresh it? Cache/SQL refresh button in administration is not enough (browser refersh also not of course).

3) Sometimes even the steps in (2) are not enough. The preview of the post is okay, but after submitting still only BBCode is displayed. In that case I have to make some change to the source of the post, add an empty line before my BBCode or something and then not only preview but also the post itself is displayed ok.

4) Having the BBCode defined as:

Code: Select all

[test]{TEXT}[/test]
<!-- {TEXT} -->
results when used in HTML code:

Code: Select all

[test]display me in the comment[/test]
<!-- {TEXT} -->
This example does not make much sense but I have an use case for that (also with combining multiple BBCodes). I guess the TEXT should be replaced.

User avatar
JoshyPHP
Code Contributor
Posts: 684
Joined: Mon Jul 11, 2011 12:28 am

Re: BBCode multiple problems

Post by JoshyPHP » Tue Feb 07, 2017 4:49 am

The first one is a known issue. You'd need to replace the BBCode definitions with a single one that handles both cases:

Code: Select all

[custom={NUMBER;optional}]{TEXT}[/custom]
If you can use the phpBB command-line interface there is a "reparser:reparse" command that will cause all the posts to be reparsed.

I don't think that tokens work inside of comments anymore and I'm not sure they ever will. What's your actual use case for it?
I wrote the thing that does the BBCodes in 3.2. Unless it broke yours, in which case it was somebody else with a similar name.

Nethar
Registered User
Posts: 6
Joined: Mon Feb 06, 2017 10:13 pm

Re: BBCode multiple problems

Post by Nethar » Tue Feb 07, 2017 8:26 am

Thank you very much for your answer!

1) thanks for info, i changed my BBCodes, works ok. Is that a temporary workaround or is this supposed to be permanent way how to do it? Variant without attribute is the main option for my users used in most cases, so it will be annoying for them I guess to insert BBCode by button from bar above and have to delete the "=" character everytime.

2 & 3) I did not know about that interface, great, will try later today when I will have access to my server.

4) This one is not so critical as cases above. The comment can be used by my external parser to get more information about the forum to create some custom-made table of contents, etc. I will adapt my own scripts so the comments will not be necessary.

User avatar
JoshyPHP
Code Contributor
Posts: 684
Joined: Mon Jul 11, 2011 12:28 am

Re: BBCode multiple problems

Post by JoshyPHP » Tue Feb 07, 2017 8:45 am

Permanent, although it would be theoretically possible to automatize the task for a seamless transition. Up till now I had never considered the UI issue you describe so err... I don't know. That's probably something that could be fixed via an extension, some JavaScript or in the core directly. The limiting factor is finding someone willing and able to put in the time.

About the CLI, the command is reparser:reparse and you can use the built-in help command to get a list of options.

About your table of contents, if you have a link to a page that shows it in action I'd be interested in seeing it. I maintain the library that handles BBCodes/formatting in phpBB 3.2 so real-life usage is valuable information to me.
I wrote the thing that does the BBCodes in 3.2. Unless it broke yours, in which case it was somebody else with a similar name.

User avatar
JoshyPHP
Code Contributor
Posts: 684
Joined: Mon Jul 11, 2011 12:28 am

Re: BBCode multiple problems

Post by JoshyPHP » Tue Feb 07, 2017 10:24 am

Nethar wrote:
Tue Feb 07, 2017 8:26 am
I will adapt my own scripts so the comments will not be necessary.
I forgot to mention you can use XSL if you want to keep your comment. Your template would be something like that:

Code: Select all

<xsl:comment> {TEXT} </xsl:comment>
In general I'd recommend storing metadata in HTML attributes though, so you should probably update your script anyway. There are some things you can't have in comments (such as --) and they're generally less reliable.
I wrote the thing that does the BBCodes in 3.2. Unless it broke yours, in which case it was somebody else with a similar name.

Nethar
Registered User
Posts: 6
Joined: Mon Feb 06, 2017 10:13 pm

Re: BBCode multiple problems

Post by Nethar » Tue Feb 07, 2017 1:52 pm

reparser - thanks, very useful, will try after work at home ;-)

comments - thank for a recommendation, I will take a look at it, it is not so urgent but could be useful

real life usage - well little bit hard to explain and also the pages are in Czech language, but I maintain for example a forum about whisky. Here you can see how users write their unified reviews: http://whisky.nethar.cz/forum/viewtopic ... 195#p29188 - As you can see the BBCode is not working, it need to reparsed.
Which then results in some table like this: http://whisky.nethar.cz/forum/viewtopic ... 464#p33464 - you can see a colour scale, points, aroma, taste, links, etc.
That code is then used by my simple PHP parser to generate for example list of bottles or list of reviews and things like that (HTML comments are not needed):
http://whisky.nethar.cz/forum/recenze/lahve.php
http://whisky.nethar.cz/forum/recenze/
They are of course not completely working right now because of my yesterday's BBCode changes.

Edit: Now reparsed, so the BBCode is not visible I guess. The source of the one of them is

Code: Select all

[recenze][barva]2[/barva]
[alkohol]46[/alkohol]
[vlastni=Původ]Réunion/Francie[/vlastni] 
[vlastni=RumRatings][url]https://www.rumratings.com/brands/4211-plantation-reunion-15-year-single-cask-port-ruby-finish[/url][/vlastni]
[aroma=88]V prvním dojmu agricole styl, ale hodně ztěžklý, hutný, čokoládově dřevitý. Jinak míza, kůra sloupnutá čerstvě z listnatého stromu, včelí plástve, trochu kokos a těžká exotická dřevitost.[/aroma]
[chut=92]Překvapivě sladká chuť, s jemnou kyselinkou, čokoládou, těžkým dřevem a nádechem lékořice a propolisu.[/chut]
[body]90[/body]
[shrnuti]Ochutnávali jsme s josém na degustačním večeru v českolipském Baru/Kavárně Kocour. Zaměřili jsme se hlavně na novinky roku 2016 od Plantation, novou single cask řadu, kdy jsme postupně ochutnali Réunion 15 yo, Panamu 8 yo, Haiti XO a Barbados 12 yo. K tomu jsme přidali i jedno starší single cask plnění, Cuba 1998. Nová řada je naprosto fantastická a tento skončil z pěti ochutnaných SC na třetím místě. Kvalita v těžším a hutnějším hávu.[/shrnuti][/recenze]
Last edited by Nethar on Tue Feb 07, 2017 10:02 pm, edited 1 time in total.

Nethar
Registered User
Posts: 6
Joined: Mon Feb 06, 2017 10:13 pm

Re: BBCode multiple problems

Post by Nethar » Tue Feb 07, 2017 9:06 pm

"reparser:reparse" command worked great. Thank you very much for fast responses and good luck with future versions.

Nethar
Registered User
Posts: 6
Joined: Mon Feb 06, 2017 10:13 pm

Re: BBCode multiple problems

Post by Nethar » Thu Sep 21, 2017 8:09 pm

After upgrade of phpBB to 3.2.1 it stopped working. It seems the xls:when test is not processed correctly, the condition is always true even if no NUMBER parameter is provided (and no equal sign), so the brackets with "b" and no number are displayed. Any suggestion? Can I rewrite it somehow?

Code: Select all

[aroma={NUMBER;optional}]{TEXT}[/aroma]

Code: Select all

<xsl:choose>
	<xsl:when test="@*">
<tr><td align="right" valign="top"><i>Aroma:</i></td><td align="left" valign="top">{TEXT} <i>({NUMBER} b)</i></td></tr>
	</xsl:when>
	<xsl:otherwise>
<tr><td align="right" valign="top"><i>Aroma:</i></td><td align="left" valign="top">{TEXT}</td></tr>
	</xsl:otherwise>
</xsl:choose>

User avatar
JoshyPHP
Code Contributor
Posts: 684
Joined: Mon Jul 11, 2011 12:28 am

Re: BBCode multiple problems

Post by JoshyPHP » Fri Sep 22, 2017 12:14 am

It could be a bug. As a workaround, you can use that template instead:

Code: Select all

<xsl:choose>
	<xsl:when test="@aroma">
<tr><td align="right" valign="top"><i>Aroma:</i></td><td align="left" valign="top">{TEXT} <i>({NUMBER} b)</i></td></tr>
	</xsl:when>
	<xsl:otherwise>
<tr><td align="right" valign="top"><i>Aroma:</i></td><td align="left" valign="top">{TEXT}</td></tr>
	</xsl:otherwise>
</xsl:choose>
I wrote the thing that does the BBCodes in 3.2. Unless it broke yours, in which case it was somebody else with a similar name.

Nethar
Registered User
Posts: 6
Joined: Mon Feb 06, 2017 10:13 pm

Re: BBCode multiple problems

Post by Nethar » Fri Sep 22, 2017 7:20 am

Works fine, thank you very much, workaround is ok for me.

Post Reply

Return to “[3.2.x] Support Forum”

Who is online

Users browsing this forum: david63 and 17 guests

cron