![]() |
|
#1
|
|||
|
|||
Php bbcode issueHi I am attempting to use the php bbcode function listed in the Code Archive forum but I am getting an error when trying to process information from a form.
I just created a basic form with a text area to test the code Code:
And I have the php bbcode stored within the highlight.php file and I am using the function like [code] processbb_php($contents); [/php] Am I using the function correctly? If not then could you please provide an example as to the correct way to do this. Thanks in Advance |
|
#2
|
||||
|
||||
|
Hello Caged,
Looking at your example above, and from what I can assume from it, it does seem like that function: processbb_php() will not work for you. It all depends on what is inside $contents; e.g. PHP Code:
Also, it would matter if the string is passed through htmlentities() / htmlspecialchars() before-hand or not... __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#3
|
|||
|
|||
|
I thought the highlight_php function handled html as well?
Will the contents need to be passed through htmlentities first and then sent to your bb code function? $contents will contain normal text as well as php code mixed with html just like your article system on your main site. Basically I'm wanting to do something alot like you got here...provide my editors a means of making php code stand out among there normal instructions. |
|
#4
|
||||
|
||||
|
Take a look at the example at the bottom of this thread: http://www.gidforums.com/t-727.html.
Yes, php highlighting will take care of the html as well but I preferred to wrap the block with <pre> tags so I had to remove all and line breaks inserted by the function (in highlighted PHP code). Usually, I make it a habit to pass any string (potentially supplied by others) through htmlentities() first. So, I would normally start working on $contents, with this line: PHP Code:
But if you decide to do this too, you have to add (to the top) a line in the custom function parsePHP( $str ). PHP Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
Recent GIDBlog
2nd Week of IA Training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Optimizing your web server with Turck MMCache for PHP | JdS | Web Hosting Forum | 2 | 07-Jan-2004 07:48 |
| apache2 - php cgi fehler - schleife | inna | Apache Web Server Forum | 8 | 27-Nov-2003 09:55 |
| [Linux] Installing PHP --with-mcrypt | JdS | Web Hosting Forum | 0 | 20-Aug-2003 08:40 |
| PHP in HTML | jrobbio | Web Design Forum | 4 | 24-Jul-2003 06:05 |
| All the big PHP script collections that matter | jrobbio | MySQL / PHP Forum | 5 | 06-Jun-2003 16:14 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The