Topic: BBcode : align
Hello i have migrated my phpbb forum to punbb but the post who haves the align method of BBcode have some troubles of display. Is there a solution ? The align method can be add to punbb ?
thanks a lot !
You are not logged in. Please login or register.
PunBB Forums → PunBB 1.2 troubleshooting → BBcode : align
Hello i have migrated my phpbb forum to punbb but the post who haves the align method of BBcode have some troubles of display. Is there a solution ? The align method can be add to punbb ?
thanks a lot !
I thought the converter stripped out those alignment tags. Hmm.
To answer your question, no. There's no align tag in PunBB and I doubt it will ever be added.
here is some exemple of the bug : http://okparanoid.free.fr/punbb-1.2.1/v … php?id=135
http://okparanoid.free.fr/punbb-1.2.1/v … php?id=473
dont worry about the color and the presentation it's only a test forum...
is the implementation of align method too hard for the result or it has an other inconvenience ?
Well, it has the "inconvenience" of being another feature and as I'm sure you're aware of, PunBB is not about features. If anything, we try to keep the number of features to a minimum. It if isn't absolutely vital, it shouldn't be in PunBB.
Oh yes i'm aware of it !
And it's why i like your works...
The utility of features is very subjective otherwise. My forum is a forum of a french rock group and people talk about news of the worlds, arts etc. Some of this post their own "poem", they post some image with the text and the presentation of the post is for us important. It is a part of the post.
In other part they don't care to know how much times a topic has been read or if the poster is online or not. And i know that this feature is very important for others forums.
For me the "ideal" forum is a forum where posts are in te center of it. A forum "at the service of the post" (oups).
But i understand your choice, i know that forum have multiple utility and it's hard to deal with all of this. Yours is the best i have found so...
Thanks for your works !
However, adding support for the align BBCode tag via a mod is not that difficult.
and what about the "bug"
The bug?
I talk about the display bug that i have after the converstation phpbb->punbb you can find two examples with the links i have given.
I say "bug" because you seem to say that the converter should deal with this (drop them)...
I found in the source of punbb the function to deal with the bbcode, here is an extract :
$pattern = array('#\[b\](.*?)\[/b\]#s',
'#\[i\](.*?)\[/i\]#s',
'#\[u\](.*?)\[/u\]#s',
'#\[url\](.*?)\[/url\]#e',
'#\[url=(.*?)\](.*?)\[/url\]#e',
'#\[email\](.*?)\[/email\]#',
'#\[email=(.*?)\](.*?)\[/email\]#',
'#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#s');
$replace = array('<strong>$1</strong>',
'<em>$1</em>',
'<span class="bbu">$1</span>',
'handle_url_tag(\'$1\')',
'handle_url_tag(\'$1\', \'$2\')',
'<a href="mailto:$1">$1</a>',
'<a href="mailto:$1">$2</a>',
'<span style="color: $1">$2</span>');
// This thing takes a while! :)
$text = preg_replace($pattern, $replace, $text);
if y want the align method, shall i just add this '#\[align=(left|center|right)\[/align\]#'
and this '<span align="align: $1">$2</span>' in the two arrays ? Or there are other modifications to do ?
can help me for the correct syntaxes i dont know how to use it ?
Yes, that should do it. However, in your case, you'll have to take into account the ID that phpBB put in there. You seem to know a little regex, so I'll leave it up to you
A possible problem might occur if people wrap e.g. a code box in the align tag. It will most likely generate invalid markup. Just so you know.
If you try and nest either code tags or quote tags inside the align span it will certainly generate rubbish markup. You will end up with something like
<span></p><div> .......</div><p></span>
Not only will it be invalid but might break the page.
it does'nt work
here is the code i have :
$pattern = array('#\[b\](.*?)\[/b\]#s',
'#\[i\](.*?)\[/i\]#s',
'#\[u\](.*?)\[/u\]#s',
'#\[url\](.*?)\[/url\]#e',
'#\[url=(.*?)\](.*?)\[/url\]#e',
'#\[email\](.*?)\[/email\]#',
'#\[email=(.*?)\](.*?)\[/email\]#',
'#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#s',
'#\[align=(left|center|right)\[/align\]#');
$replace = array('<strong>$1</strong>',
'<em>$1</em>',
'<span class="bbu">$1</span>',
'handle_url_tag(\'$1\')',
'handle_url_tag(\'$1\', \'$2\')',
'<a href="mailto:$1">$1</a>',
'<a href="mailto:$1">$2</a>',
'<span style="color: $1">$2</span>',
'<span align="align: $1">$2</span>');
and the result : http://okparanoid.free.fr/punbb-1.2.1/v … 527#p6527. Any ideas ?
i know what's regular expression but don't know how tu use it, i wrote this by chance and by looking your code but drop the id of phpbb in the [align] code seem to be too difficult for me . Why they use a id ?
and Paul i dont know html xhtml, is there a solution as what you say, is the use of span wrong ?
thanks
1. In some cases span will be ok in others not. It depends what you are putting inside it.
2. There is no solution except configure the align tag so that it does not work with quote and code tags but that requires a lot of changes to parser.php.
3. The align attribute should not be used with xhtml 1.0. If you want to align something you use text-align or give it a width and use margin-auto so your align tag should generate a class which is handled by the stylesheet or an inline style.
EDIT:
Actually there is a way to do it which will work in most cases and that is handle align in a similar way to quotes. All aligned content will then be in a seperate div and taken out of the normal flow of content so no problems.
would it not be easier just to delete the align tags from your forum? i mean they don't look that important
'#\[align=(left|center|right)\[/align\]#');
should be
'#\[align=(left|center|right)\]\(.*?)[/align\]#');
I found in the source of punbb the function to deal with the bbcode, here is an extract :
$pattern = array('#\[b\](.*?)\[/b\]#s', '#\[i\](.*?)\[/i\]#s', '#\[u\](.*?)\[/u\]#s', '#\[url\](.*?)\[/url\]#e', '#\[url=(.*?)\](.*?)\[/url\]#e', '#\[email\](.*?)\[/email\]#', '#\[email=(.*?)\](.*?)\[/email\]#', '#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#s'); $replace = array('<strong>$1</strong>', '<em>$1</em>', '<span class="bbu">$1</span>', 'handle_url_tag(\'$1\')', 'handle_url_tag(\'$1\', \'$2\')', '<a href="mailto:$1">$1</a>', '<a href="mailto:$1">$2</a>', '<span style="color: $1">$2</span>'); // This thing takes a while! :) $text = preg_replace($pattern, $replace, $text);
Where is that function located? I can't find it
PunBB Forums → PunBB 1.2 troubleshooting → BBcode : align
Powered by PunBB, supported by Informer Technologies, Inc.