Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 12-24-2008, 10:49 PM [PHP] as a BBcode
Super Talker

Posts: 102
Trades: 0
What would be a code so I can have [ php] as a bbcode.
Aaron™ is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-25-2008, 04:43 AM Re: [PHP] as a BBcode
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
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?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-25-2008, 10:33 AM Re: [PHP] as a BBcode
Super Talker

Posts: 102
Trades: 0
Like So it will Highlight and I want PHP as a BBCode like
PHP Code:
echo 'Hi'
Aaron™ is offline
Reply With Quote
View Public Profile
 
Old 12-25-2008, 10:43 AM Re: [PHP] as a BBcode
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
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..
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 12-25-2008, 10:46 AM Re: [PHP] as a BBcode
Decaf's Avatar
Ultra Talker

Posts: 489
Name: Adam
Trades: 0
Quote:
Originally Posted by Aaron™ View Post
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...
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Decaf is offline
Reply With Quote
View Public Profile Visit Decaf's homepage!
 
Old 12-25-2008, 12:51 PM Re: [PHP] as a BBcode
Super Talker

Posts: 102
Trades: 0
Exactly what Decaf just said, I know how to make BBcodes but I don't know how to make it highlight with the php.
Aaron™ is offline
Reply With Quote
View Public Profile
 
Old 12-25-2008, 02:34 PM Re: [PHP] as a BBcode
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
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?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-25-2008, 02:58 PM Re: [PHP] as a BBcode
Decaf's Avatar
Ultra Talker

Posts: 489
Name: Adam
Trades: 0
Quote:
Originally Posted by chrishirst View Post
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...)
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Decaf is offline
Reply With Quote
View Public Profile Visit Decaf's homepage!
 
Old 12-25-2008, 05:50 PM Re: [PHP] as a BBcode
Super Talker

Posts: 102
Trades: 0
Lol ok, you know the bb code [ php] yeah ok, so I want to make a BB code like that....
Aaron™ is offline
Reply With Quote
View Public Profile
 
Old 12-25-2008, 06:34 PM Re: [PHP] as a BBcode
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
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?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-25-2008, 06:36 PM Re: [PHP] as a BBcode
Super Talker

Posts: 102
Trades: 0
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..
Aaron™ is offline
Reply With Quote
View Public Profile
 
Old 12-25-2008, 06:55 PM Re: [PHP] as a BBcode
Decaf's Avatar
Ultra Talker

Posts: 489
Name: Adam
Trades: 0
so, your wondering how to make bb code?

If so then the answers are in this post.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Decaf is offline
Reply With Quote
View Public Profile Visit Decaf's homepage!
 
Old 12-25-2008, 07:23 PM Re: [PHP] as a BBcode
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Use GeSHi
__________________
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?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to [PHP] as a BBcode
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.35253 seconds with 12 queries