This is a discussion on "[SOLVED] Converting BBcode to HTML" within the PHP Forum section. This forum, and the thread "[SOLVED] Converting BBcode to HTML are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
[SOLVED] Converting BBcode to HTML
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
[SOLVED] Converting BBcode to HTML
I am having problems with a php script that converts BBcode to HTML.
All the script works fine and converts the BBCode to HTML as expected apart from one......the [size] tag. When I add the [size] tags to whatever and I preview the post, it doesn't do any styling at all. I can't see anything wrong with the regex so I don't know why it won't convert these tags.
|
|
|
|
#2
|
||||
|
||||
|
Re: Converting BBcode to HTML
Hi Adrock,
The replace ie. style="font-size: $1" what is being passed with the [size=x] tags? If is's just an integer I don't think this is a valid font-size value.
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#3
|
|||
|
|||
|
Re: Converting BBcode to HTML
Hello Rakuli
You helped me out with this before in the JavaScript forum. What is being passed is [size="150%"] for example. They go from 50%, 75%, 100%, 150% and 200% I have tried changing the form option values to pt and px but it still doesn't work. If you need to see the JavaScript or the form, i'll post the code |
|
#4
|
||||
|
||||
|
Re: Converting BBcode to HTML
Okay, it looks like you're capturing the whole pattern -- size=(.+?)
This would then create a span that looks like <span style="font-size:"150%"">etc... Can you try removing the quotes from around the size?
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#5
|
|||
|
|||
|
Re: Converting BBcode to HTML
This is part of the form that does the size option
|
|
#6
|
||||
|
||||
|
Re: Converting BBcode to HTML
Hi Adrock, I just tracked down the old javascript thread http://www.webforumz.com/javascript-...ext-editor.htm.
I went to the page and when it is written to the page in the preview, it is writing front-size: xx%px, a percentage and pixels. Have you just changed that recently?
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#7
|
||||
|
||||
|
Re: Converting BBcode to HTML
You could also try changing the form inputs to absolute values
xx-small, x-small, normal, x-large, xx-large There is nothing wrong with the PHP becuase it is replacing as required.
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#8
|
|||
|
|||
|
Re: Converting BBcode to HTML
No...this is exactly how it came when i downloaded it.
I got the source code for the editor and the converter from one place but the converter wasn't good so i got another one from somewhere else |
|
#9
|
|||
|
|||
|
Re: Converting BBcode to HTML
I tried changing the form select values to 8px, 9px, 10px, 12px and 14px and when I preview, all i get is a few dashes.
I have also tried using pts too and even tried using xx-small etc but none of it works |
|
#10
|
|||
|
|||
|
Re: Converting BBcode to HTML
I have fixed it
I had to take the % sign out of this
|
|
#11
|
||||
|
||||
|
Re: Converting BBcode to HTML
LOL, I saw that % sign in the outputted code but didn't even think to see if it was in the preg replace (I was thinking it was a format part like in sprintf)
![]() Soory bout that, glad you sorted it.
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [SOLVED] converting flash to html | Posie | Starting Out | 3 | Dec 2nd, 2007 20:04 |
| Function to convert BBcode to HTML | AdRock | PHP Forum | 4 | Sep 2nd, 2007 12:41 |
| Converting from HTML to XHTML | Aaron1988 | Web Page Design | 1 | Dec 4th, 2006 15:09 |
| help with converting HTML to XHTML | sing2trees | Web Page Design | 4 | Sep 20th, 2006 03:35 |
| I'm converting my pages from HTML to CSS,,, Help me! | ahm531 | Web Page Design | 9 | Sep 6th, 2006 10:06 |