Icy Phoenix

     
 


Post new topic  Reply to topic 
Page 1 of 1
 
 
Reply with quote Download Post 
Post Adding New BBcode Tags 
 
Ok now that I've got my code 2 html BBcode working,
I would like to try adding some whole new BBcode tags, to use a few Java functions for some cool text effects.

Could some one explain what I need to do to define new BBcode tags.
 



 
glenfletSend private messageVisit poster's website  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Reply with quote Download Post 
Post Re: Adding New BBcode Tags 
 
You should be able to find that in the docs section - And it's a whole lot different from the usual way of doing it.
 
 
 
Back to topPage bottom
Reply with quote Download Post 
Post Re: Adding New BBcode Tags 
 
Lopalong wrote: [View Post]
You should be able to find that in the docs section - And it's a whole lot different from the usual way of doing it.


I had a look there, but could find any thing about how to add the new tags.

Can you provide a direct link to the topic please.

Edit: I would also like to replace phpBB3 BBcode, with Icy Phoenix BBcode, as phpBB 3 is to hard to modify to my own needs, any suggestions on how I should go about this?
 



 
glenfletSend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Adding New BBcode Tags 
 
You're right mate, difficult to locate for the uninitiated.

There's a lot of work being done on docs now - but that's not going to help short-term.

Though this should help.

h**p://***.icyphoenix.com/viewtopic...&p=29850#p29850
 
 
 
Back to topPage bottom
Reply with quote Download Post 
Post Re: Adding New BBcode Tags 
 
I had a look at that topic, but I don't see how that tells, me how to add ne BBcode tags.

I've got some javascript I want to use with BBcode.

i.e.
Code: [Download] [Hide] [Select]
<script language="javascript">
var text = "Hello World!"
var speed = 80
rainbow()
</script>


Where the BBcode would be
Code: [Download] [Hide] [Select]
[rainbow speed=80]Hello World![/rainbow]


i.e.
Code: [Download] [Hide] [Select]
<script language="javascript">
var text = "Hello World!"
var speed = 80
var basecolor = "#808080"
var textcolor = "#00ffff"
neonText()
</script>


Where the BBcode would be
Code: [Download] [Hide] [Select]
[neon speed=80 basecolor=128,128,128 textcolor=0,255,255]Hello World![/neon]


I also want to rename the existing rainbow to gradient.

I can make the php to generate the HTML output just fine, it just how to add the tags to the BBcode that I can't do, and how to tell it what variable I'm look for, to cofirm I understant that propely.
 



 
glenfletSend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Adding New BBcode Tags 
 


This is an unreleased MOD that I've done for the next version of IP (Though it's basically the same) and it should contain all of the examples you need - Plus put you in the right places to compare other bbCode entries that switch other params as well.

And this example adds a url option - You only want simple tags.

Spoiler: [ Show ]

 
 
 
Back to topPage bottom
Reply with quote Download Post 
Post Re: Adding New BBcode Tags 
 
You need to add the tag into this array: var $allowed_bbcode = array (follow what has been done for others...)

Then you need to add the IF statement into the function process_tag(&$item) adding the HTML you want to output.

That should be enough for your BBCode to work.
 




____________
Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Adding New BBcode Tags 
 
Ok,I've got the BBcode working now, thanks for the help

How to Add Rainbow and Neon Text

EXTRACT texteffects.zip to templates/common/js

OPEN includes/bbcode.php
FIND
Code: [Download] [Hide] [Select]
            'rainbow' => array(
                    'nested' => true,
                    'inurl' => true,
                    'allow_empty' => false,
                    ),

REPLACE WITH
Code: [Download] [Hide] [Select]
            'gradient' => array(
                    'nested' => true,
                    'inurl' => true,
                    'allow_empty' => false,
                    ),

ADD AFTER
Code: [Download] [Hide] [Select]
            'neon' => array(
                    'nested' => false,
                    'inurl' => false,
                    ),
            'rainbow' => array(
                    'nested' => false,
                    'inurl' => false,
                    ),

FIND
Code: [Download] [Hide] [Select]
        // RAINBOW
        if($tag === 'rainbow')
        {
            /*
            if($this->is_sig)
            {
                return $error;
            }
            */
            $html = rainbow($content);
            return array(
                'valid' => true,
                'html' => $html,
                'allow_nested' => false,
            );
        }

REPLACE WITH
Code: [Download] [Hide] [Select]
        // GRADIENT
        if($tag === 'gradient')
        {
            /*
            if($this->is_sig)
            {
                return $error;
            }
            */
            $html = rainbow($content);
            return array(
                'valid' => true,
                'html' => $html,
                'allow_nested' => false,
            );
        }

ADD AFTER
Code: [Download] [Hide] [Select]
        // RAINBOW
        if($tag === 'rainbow')
        {
            /*if($this->is_sig)
            {
                return $error;
            }*/
            $speed = 80;
            if(isset($item['params']['speed']))
            {
                try
                {
                    $speed = intval($item['params']['speed']);
                } catch (Exception $e) {
                    break;
                }
            }
            $text = $content;
            if(strpos($text,"n") !== false)
            {
                return $error;
            }
            $html = "n<script language="javascript" type="text/javascript">nvar text = "". $text . ""nvar speed = " . $speed . " nrainbow()n</script>n<noscript>" . $text . "</noscript>n";
            return array(
                'valid' => true,
                'html' => $html,
            );
        }

        // NEON
        if($tag === 'neon')
        {
            /*if($this->is_sig)
            {
                return $error;
            }*/
            $speed = 80;
            if(isset($item['params']['speed']))
            {
                try
                {
                    $speed = intval($item['params']['speed']);
                } catch (Exception $e) {
                    break;
                }
            }
            $colors = array();
            $red = 128;
            $green = 128;
            $blue = 128;
            if(isset($item['params']['basecolor']))
            {
                try
                {
                    $colors = split(",",$item['params']['basecolor']);
                    for($i=0;$i<3;$i++)
                    {
                        if (intval($colors[$i]) > 255)
                        {
                            $colors[$i] = "255";
                        }
                        elseif (intval($colors[$i]) < 0)
                        {
                            $colors[$i] = "0";
                        }
                    }
                    $red = intval($colors[0]);
                    $green = intval($colors[1]);
                    $blue = intval($colors[2]);
                } catch (Exception $e) {
                    break;
                }
            }
            $basecolor = "rgb(" . $red . ", " . $green . ", " . $blue . ")";
            $red = 64;
            $green = 64;
            $blue = 255;
            if(isset($item['params']['textcolor']))
            {
                try
                {
                    $colors = split(",",$item['params']['textcolor']);
                    for($i=0;$i<3;$i++)
                    {
                        if (intval($colors[$i]) > 255)
                        {
                            $colors[$i] = "255";
                        }
                        elseif (intval($colors[$i]) < 0)
                        {
                            $colors[$i] = "0";
                        }
                    }
                    $red = intval($colors[0]);
                    $green = intval($colors[1]);
                    $blue = intval($colors[2]);
                } catch (Exception $e) {
                    break;
                }
            }
            $textcolor = "rgb(" . $red . ", " . $green . ", " . $blue . ")";
            $text = $content;
            if(strpos($text,"n") !== false)
            {
                return $error;
            }
            $html = "n<script language="javascript" type="text/javascript">nvar text = "". $text . ""nvar speed = " . $speed . " nvar basecolor = "" . $basecolor . ""nvar textcolor = "" . $textcolor . ""nneon()n</script>n<noscript>" . $text . "</noscript>n";
            return array(
                'valid' => true,
                'html' => $html,
            );
        }


OPEN templates/mg_themes/overall_include.tpl
FIND
Code: [Download] [Hide] [Select]
{UPI2DB_FIRST_USE}

ADD BEFORE
Code: [Download] [Hide] [Select]
<script type="text/javascript" src="{FULL_SITE_PATH}{T_COMMON_TPL_PATH}js/texteffects.js"></script>


NOTE: If you have other base template, You'll need to modify them as well.

BBcode Info
Key
{optional=Defualt Value}
required=Format

Neon
Highlight letter by letter at given speed, stays lit for a bit thte restarts.
Code: [Download] [Hide] [Select]
[neon {speed=80} {basecolor=128,128,128} {textcolor=0,0,255}]Text here[/neon]


Rainbow
Text changes colour at given speed
Code: [Download] [Hide] [Select]
[rainbow {speed=80}]Text here[/neon]


NOTE: the old rainbow is now gradient

texteffects.zip
Description: Text effects Java Script 
Download
Filename: texteffects.zip
Filesize: 871 Bytes
Downloaded: 212 Time(s)

 



 
glenfletSend private messageVisit poster's website  
Back to topPage bottom
Post new topic  Reply to topic  Page 1 of 1
 


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML




 
Permissions List
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events