1

Topic: adding bbcode

i have seen similar suject in the forum but none where giving the idea on how to do it i would like to add some bbcode to my forum if its possible code such as ,if possible [align=right]http://www.http.com/blahvlah.jpg[/align] as an example but it dont quite get how to do it and if its possible i do think that it as to be added to the parser.php file but id like to have a cue or a pointer on how to do it

Re: adding bbcode

I'm not sure XHTML allows you to align text, if not here's why you didn't find the mod

3

Re: adding bbcode

Strofanto wrote:

I'm not sure XHTML allows you to align text, if not here's why you didn't find the mod

well the idea is not only with an align code but also a couple of other so basicly my question would be more like how do you create bbcode and add them to the forum ,alignment code was more of an example

Re: adding bbcode

I think it might be changing the code, if I'm not wrong you can find it on parser.php

5 (edited by shinko_metsuo 2005-04-20 00:03)

Re: adding bbcode

I have what you are looking for and XHTML valid

ok in include/parser.php find

                     '#\[email=(.*?)\](.*?)\[/email\]#',

after add

                     '#\[align=(.*?)\](.*?)\[/align\]#',

find

                     '<span style="color: $1">$2</span>');

before add

                     '<p/><div align="$1">$2</div><p>',

make sure you have them in the same order of the array or else your BB code will be wack

Re: adding bbcode

You might want to edit help.php (this is for english)

in help.php find

        [color=blue]<?php echo $lang_help['Blue text'] ?>[/color] <?php echo $lang_help['produces'] ?> <span style="color: blue"><?php echo $lang_help['Blue text'] ?></span><br />

after add

        [align=right]<?php echo $lang_help['align text'] ?>[/align] <?php echo $lang_help['produces'] ?> <div align="right""><?php echo $lang_help['align text'] ?></div>

add this to lang/English/help.php

'align text'            =>    'This text is to the Right',

I'll have the french later.

7

Re: adding bbcode

Won't that code mean you could have a <div> inside a <p> which is improperly nested markup.

Re: adding bbcode

add this to lang/French/help.php

'align text'            =>    'Ce texte est à la droite',

My french is not the greatest so you might want to check that

9 (edited by shinko_metsuo 2005-04-19 23:52)

Re: adding bbcode

Paul wrote:

Won't that code mean you could have a <div> inside a <p> which is improperly nested markup.

I know its a bit hacked but it does the job

10

Re: adding bbcode

No. A <div> inside a <p> is not valid regardless of what the validator may say. Only inline elements are allowed inside a <p> tags.

What you need is
<span class="bbalign"> </span>

.bbalign <text-align: right; display:block}

11 (edited by shinko_metsuo 2005-04-19 23:59)

Re: adding bbcode

sorry my bad I knew that.

but doing it with CSS involves more work as in you must do 3 times and its edits to the style sheet. Most people try to avoid that

12 (edited by shinko_metsuo 2005-04-20 00:04)

Re: adding bbcode

that makes sence smile and it works.

Edit: I also noticed that the parser takes out the extra <p> when its alone

13 (edited by Ataxy 2005-04-20 01:26)

Re: adding bbcode

shinko_metsuo wrote:

add this to lang/French/help.php

'align text'            =>    'Ce texte est à la droite',

My french is not the greatest so you might want to check that

merci metsuo si tu a besoin de traduire quoi que ce soit ecrit moi ici au Québec plusieur personne parle les deux langue

translation

thank you metsuo if you ever need translation write me here in Québec alot of people speak both language

'align text'            =>    'Ce texte est a droit',

oh and one more thing i know it may sound like anoying but about the html <table> code would it be possible to or do you feel like saying "lol want a cofee with this!"

Re: adding bbcode

I'm not sure about tables plus tables are very sloppy and sloppyer when you have a pure CSS setup. You may have to edit your CSS to do it then have your own bbcode like [th] [tr] [td] to work with the CSS

15

Re: adding bbcode

Just a suggestion. The best way of finding out if some bit of bbcode is likely to screw the layout is to save a page as a static html file and then edit the markup manually and see what happens. That way if something is likely to cause problems you find out before a lot of messing around with parser.php.

Re: adding bbcode

there was a mod someone made that its supposed to help in making stylesheets it has the markup of all sorts of pages in one that would be great to edit for something like that

17

Re: adding bbcode

Paul wrote:

Just a suggestion. The best way of finding out if some bit of bbcode is likely to screw the layout is to save a page as a static html file and then edit the markup manually and see what happens. That way if something is likely to cause problems you find out before a lot of messing around with parser.php.

sorry but how do you make a static page of the forum that  i can then post in sorry its just that i am starting to get my hand into php

18

Re: adding bbcode

You can't make a static page that you post in, you just test the markup which you want the bbcode to generate by editing manually. If it breaks then forget about that bit of bbcode.

BTW: I would certainly forget about trying to add tables.

19

Re: adding bbcode

its just that i would like for user to be able to customise there post by placing text on the left and image on the right and vice-versa anyway like i said in a erlyer post those are wishes if they are not doable then i can live with it
here are some more code id like to see
<li></li> =[li][/li]
<ul></ul>=[ul][/ul]
<ol></ol>=[ol][/ol]
but the one idd like to see the most is the table code as it offers lots of possibility in post editing

Re: adding bbcode

a rather interesting way of doing tables http://mypunbb.com/files/wiki/doku.php? … tax#tables

21

Re: adding bbcode

wow this is interesting

Re: adding bbcode

i might make an addon for the wiki mod that allows you to use the wiki parser on forum posts, not sure how well it will work though especially with current bbcode, or how fast it would be since the wiki mod actually caches all the parsed files after the first visit since it takes such a long time to proccess them...

anyway there is a mod for phpbb for dokuwiki so i'll have a look at that wink

23

Re: adding bbcode

It seems viewtopic.php is slightly more robust than I thought.
http://www.post21.co.uk/pun12/bbtest.html

24

Re: adding bbcode

wow Paul thats it or pretty much without the color in the box that is really nice

25 (edited by Ataxy 2005-04-27 21:14)

Re: adding bbcode

ok here is my try at making the code work mine partially worked but not totally
here is the line i added in parser

'#\[table\](.*?),(.*?)\[/table\]#',

and

'<table><tr><td>$1</td><td>$2</td></tr>',

it did work but it messed up my layout
here is the post i made

[table][img]http://d-vault.peerforces.com/dban4.png[/img],234[/table]

here is what it did
http://d-vault.peerforces.com/table.png
but as you can se it created the table out of the post frame and under the footer
i guess thats what shinko_metsuo meant whe he said

I'm not sure about tables plus tables are very sloppy and sloppyer when you have a pure CSS setup. You may have to edit your CSS to do it then have your own bbcode like [th] [tr] [td] to work with the CSS