 |
|
|
12-24-2008, 10:49 PM
|
[PHP] as a BBcode
|
Posts: 102
|
What would be a code so I can have [ php] as a bbcode.
|
|
|
|
12-25-2008, 04:43 AM
|
Re: [PHP] as a BBcode
|
Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
|
What exactly are you asking?
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
12-25-2008, 10:33 AM
|
Re: [PHP] as a BBcode
|
Posts: 102
|
Like So it will Highlight and I want PHP as a BBCode like
|
|
|
|
12-25-2008, 10:43 AM
|
Re: [PHP] as a BBcode
|
Posts: 843
Name: Mike
Location: United Kingdom
|
http://www.google.co.uk/search?q=BBcode+PHP < 1st result.
http://uk2.php.net/manual/en/ref.bbcode.php < PHP manual page.
PHP Code:
<?php $arrayBBCode=array( ''=> array('type'=>BBCODE_TYPE_ROOT, 'childs'=>'!i'), 'i'=> array('type'=>BBCODE_TYPE_NOARG, 'open_tag'=>'<i>', 'close_tag'=>'</i>', 'childs'=>'b'), 'url'=> array('type'=>BBCODE_TYPE_OPTARG, 'open_tag'=>'<a href="{PARAM}">', 'close_tag'=>'</a>', 'default_arg'=>'{CONTENT}', 'childs'=>'b,i'), 'img'=> array('type'=>BBCODE_TYPE_NOARG, 'open_tag'=>'<img src="', 'close_tag'=>'" />', 'childs'=>''), 'b'=> array('type'=>BBCODE_TYPE_NOARG, 'open_tag'=>'<b>', 'close_tag'=>'</b>'), ); $text=<<<EOF [b]Bold Text[/b] [i]Italic Text[/i] [url]http://www.php.net/[/url] [url=http://pecl.php.net/][b]Content Text[/b][/url] [img]http://static.php.net/www.php.net/images/php.gif[/img] [url=http://www.php.net/] [img]http://static.php.net/www.php.net/images/php.gif[/img] [/url] EOF; $BBHandler=bbcode_create($arrayBBCode); echo bbcode_parse($BBHandler,$text);
# Returns # /* <b>Bold Text</b> <i>Italic Text</i> <a href="http://www.php.net/">http://www.php.net/</a> <a href="http://pecl.php.net/"><b>Content Text</b></a> <img src="http://static.php.net/www.php.net/images/php.gif" /> <a href="http://www.php.net/"> [img]http://static.php.net/www.php.net/images/php.gif[/img] </a>
*/ ?>
__________________
My Blog/Site: Please login or register to view this content. Registration is FREE
Last edited by rogem002; 12-25-2008 at 10:46 AM..
|
|
|
|
12-25-2008, 10:46 AM
|
Re: [PHP] as a BBcode
|
Posts: 489
Name: Adam
|
Quote:
Originally Posted by Aaron™
What would be a code so I can have [ php] as a bbcode.
|
PHP Code:
[php ]<?php echo 'you mean this?'; ?>[/php ]
? Just remove the spaces...
|
|
|
|
12-25-2008, 12:51 PM
|
Re: [PHP] as a BBcode
|
Posts: 102
|
Exactly what Decaf just said, I know how to make BBcodes but I don't know how to make it highlight with the php.
|
|
|
|
12-25-2008, 02:34 PM
|
Re: [PHP] as a BBcode
|
Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
|
Make it highlight what?
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
12-25-2008, 02:58 PM
|
Re: [PHP] as a BBcode
|
Posts: 489
Name: Adam
|
Quote:
Originally Posted by chrishirst
Make it highlight what?
|
PHP Code:
<?php $text = array("He","didn't","know","how","to","make","the","php","code","syntax","highlighted."); $n=0; // Print text array. while ($n<count($text)) { print "$text[$n] "; $n++; } ?>
(At least i think that was his question...)
|
|
|
|
12-25-2008, 05:50 PM
|
Re: [PHP] as a BBcode
|
Posts: 102
|
Lol ok, you know the bb code [ php] yeah ok, so I want to make a BB code like that....
|
|
|
|
12-25-2008, 06:34 PM
|
Re: [PHP] as a BBcode
|
Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
|
Do you want to know how to make syntax colouring work in posts on this forum?
OR
Do you want to know how to make syntax colouring work in posts on a different forum?
OR
Do you want to know how to create syntax colouring for a project of your own?
OR
something else.
Until you tell us EXACTLY what YOU are thinking of, we will have to continue guessing!!
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
12-25-2008, 06:36 PM
|
Re: [PHP] as a BBcode
|
Posts: 102
|
Project of my own.
my exsisting BBcode.
Code:
function bbcode($str) {
$simple_search = array(
"/\[b\](.*?)\[\/b\]/is",
"/\[i\](.*?)\[\/i\]/is",
"/\[u\](.*?)\[\/u\]/is",
"/\[center\](.*?)\[\/center\]/is",
"/\[color\=(red|green|blue|yellow)\](.*?)\[\/color\]/is",
"/\[url=(.*?)\](.*?)\[\/url\]/is",
"/\[img\](.*?)\[\/img\]/is",
"/\[quote=(.*?)\](.*?)\[\/quote\]/is",
"/\[quote\](.*?)\[\/quote\]/is",
"/\[code\](.*?)\[\/code\]/is"
);
$simple_replace = array(
"<strong>$1</strong>",
"<em>$1</em>",
"<u>$1</u>",
"<center>$1</center>",
"<font color=\"$1\">$2</font>",
"<a href=\"$1\" target=\"_blank\">$2</a>",
"<img src=\"$1\" alt=\"[image]\"/>",
"<div class=\"quotetop\">QUOTE ($1)</div><div class=\"quotemain\">$2</div>",
"<div class=\"quotetop\">QUOTE</div><div class=\"quotemain\">$1</div>",
"<div class=\"codetop\">CODE</div><div class=\"codemain\">$1</div>"
);
// Do simple BBCode's
$str = preg_replace ($simple_search, $simple_replace, $str);
return $str;
}
Last edited by Aaron™; 12-25-2008 at 06:38 PM..
|
|
|
|
12-25-2008, 06:55 PM
|
Re: [PHP] as a BBcode
|
Posts: 489
Name: Adam
|
so, your wondering how to make bb code?
If so then the answers are in this post.
|
|
|
|
12-25-2008, 07:23 PM
|
Re: [PHP] as a BBcode
|
Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
|
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
|
« Reply to [PHP] as a BBcode
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|