-
srry, but this driving me up the wall.
you know how you can use these tags
php] /php]
I want to be able to use them in my forum, but no one has an example or tutorial on how to show me...
i want to use php bbcode tags in my forum(I already have bbcode I just need a example)
uh sorry for being mean...
-
Yeah... then use PHP in the code provided in the link in post 2. As tech_support posted, he added image tags himself. Just copy the format from the other ones.
That's it.
-
I have tried to make my own php tags but the php tags are different from the img tags, for example...
img tags look like this
and in php it would look like this
But as in php, you would use these,
Code:
[php} <?php code here ?> [/php}
But what is it translated into?
like how or what is the php code to show php?
understand, no one has this in the bbcodes they have the simple stuff, like b, i, strike, u, and imgs, but what about php, can someone show me how to put php tags into bbcode cuase I can't figure it out,...
if no one can, then dont worry about it,
and post 2 does not have the php tags in it cuase I have already looked at it
and just to let you guys know my bbcode is below, to show you, i think...
PHP Code:
<?php
$message = str_replace("[b]", "<b>", $message);
$message = str_replace("[/b]", "</b>", $message);
$message = str_replace("[i]", "<i>", $message);
$message = str_replace("[/i]", "</i>", $message);
$message = str_replace("[code]", "<div style=\"border: solid 1px orange; padding:20px; margin: 20px\"><code>", $message);
$message = str_replace("[/code]", "</code></div>", $message);
$message = str_replace("[u]", "<u>", $message);
$message = str_replace("[/u]", "</u>", $message);
$message = str_replace("[s]", "<s>", $message);
$message = str_replace("[/s]", "</s>", $message);
$message = str_replace("[color=blue]", "<span style=\"color: blue\">", $message);
$message = str_replace("[/color]", "</span>", $message);
$message = str_replace("[color=red]", "<span style=\"color: red\">", $message);
$message = str_replace("[/color]", "</span>", $message);
$message = str_replace("[color=green]", "<span style=\"color: green\">", $message);
$message = str_replace("[/color]", "</span>", $message);
$message = str_replace("[color=yellow]", "<span style=\"color: yellow\">", $message);
$message = str_replace("[/color]", "</span>", $message);
$message = str_replace("[color=gray]", "<span style=\"color: gray\">", $message);
$message = str_replace("[/color]", "</span>", $message);
$message = str_replace("[color=pink]", "<span style=\"color: pink\">", $message);
$message = str_replace("[/color]", "</span>", $message);
/* here is where i get messed up and want the php tags */
$message = str_replace("[php}", "<php>", $message);
$message = str_replace("[/php}", "</php>", $message);
/* here is where i get messed up and want the php tags */
$message=eregi_replace("\\[url\\]www.([^\\[]*)\\[/url\\]","<a href=\"http://www.\\1\" target=_blank>\\1</a>",$message);
$message=eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]","<a href=\"http://www.\\1\" target=_blank>\\1</a>",$message);
$message=eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=_blank>\\1</a>",$message);
$message=eregi_replace("\\[email\\]([^\\[]*)\\[/email\\]","<a href=\"mailto:\\1\">\\1</a>",$message);
$message = str_replace('[img]', '<img src="', $message);
$message = str_replace('[/img]', '" border=0>', $message);
$message = str_replace(":)", "<img src=\"http://www.xudas.com/forum/forum/images/smile2.gif\"><BR>", $message);
$message = str_replace(":(", "<img src=\"http://www.xudas.com/forum/forum/images/sad.gif\"><BR>", $message);
$message = str_replace(":\$", "<img src=\"http://www.xudas.com/forum/forum/images/confoosed.gif\"><BR>", $message);
?>
Oh and whereever you see this( "}" ) its supposed to be this ( "]"). code gets mess up..
-
[php]<? php; ?>[/php]
Becomes:
highlight_string('<? php; ?>');
ie, [php]$code[/php]
highlight_string($php);
And you get--
-
Finally!!!! THANKYOU SO MUCH!!!
I didn't know how or what to do...
I thanked you
-
Actually i can't get it to work, is there a possible way you could post it in this format..
PHP Code:
$message = str_replace("[php}", "<?php php;{ ?>", $message);
$message = str_replace("[/php}", "<?php } ?>", $message);
Thats something I tried above and I have tried other solutions, is there a way you could show me a example using that above?
and its the same with other bbcode as in message is the text for the forums
like
Code:
$message=bbcode($message);
I hope you understand..
-
It isn't just replacing the start/end with a tag. you need to run it through the function.
Basically--
Code:
while (strpos($c,'[php]')!==FALSE&&strpos($c,'[/php]',strpos($c,'[php]'))!==FALSE) {$c = substr($c,0,strpos($c,'[php]')).highlight_string(substr($c,strpos($c,strpos($c,'[php]'),strpos($c,'[/php]',strpos($c,'[php]'))))).substr($c,strpos($c,'[/php]',strpos($c,'[php]')));}
-
ok ty so much im gonna try this!!! TY
oh is
$c where $message is supposed to be?
-
I just used $c for code since I didn't want to type a long variable name in that complex statement.
This is actually much harder than I thought it would be.
I've been testing it and the bugs are worked out, but there is a major problem.
Here's the code I have now:
Code:
while (strpos($c,'[php]')!==FALSE&&strpos($c,'[/php]',strpos($c,'[php]'))!==FALSE) { $c = substr($c,0,5+strpos($c,'[php]')).highlight_string(substr($c,strpos($c,5+strpos($c,'[php]'),6+strpos($c,'[/php]',strpos($c,'[php]')))),TRUE).substr($c,6+strpos($c,'[/php]',strpos($c,'[php]')));}
The problem, though, is the function highlight_string().
http://www.php.net/manual/en/functio...ght-string.php
Apparently it outputs rather than returning the highlighted code. A second parameter of TRUE is apparently supposed to make it return the code instead.
I set that... but... it doesn't seem to work.
Anyone used this before successfully?
Without the TRUE value, it outputs. With the TRUE value, I get a big memory allocation error--
Code:
Fatal error: Allowed memory size of 25165824 bytes exhausted (tried to allocate 8855008 bytes) in /home/livechat/public_html/sys/test.php
Ideas?
Aside from that, though, the code works just fine.
-
I messed with it briefly before, but don't remember what I did exactly. I do remember; though, that I had to use the output buffer to get it to work right. That way everything parsed wrote to the ob, then I was able to output everything at the end of the script execution.
Hope this helps.