Home  | FAQ  | Search  | Memberlist  | Usergroups  | Register  | Profile  | Log in  | Log in for your private messages
How 2 add Font Color BBCode to myBloggie

 
Post new topic   Reply to topic    myWebland Forum Index -> Customization
View previous topic :: View next topic  
Author Message
sean
Site Admin


Joined: 14 Jul 2004
Posts: 671

PostPosted: Mon Jun 12, 2006 2:25 pm    Post subject: How 2 add Font Color BBCode to myBloggie Reply with quote

This post teach you on how to add bbcode for font color to myBloggie. Please follow the below instruction carefully

1) Back-up the follow files before your proceed
- function.php ( directory : "includes/" )
- add.php ( directory : mybloggie's root" )
- edit.php ( directory : mybloggie's root" )
- formsubmit.tpl ( directory : "templates/{style or theme used}/admin/" )

2) create a new file in the "includes/" directory named : color-list.php
copy & paste the following into that file & save it

Code:
<?

if ( !defined('IN_MYBLOGGIE') )
  {
    die("You are not allowed to access this page directly !");
  }

$no_of_colors = 24;

$color[1]['colorname']='BLUE';
$color[1]['colorcode']='#0000FF';

$color[2]['colorname']='RED';
$color[2]['colorcode']='#FF0000';

$color[3]['colorname']='YELLOW';
$color[3]['colorcode']='#FFFF00';

$color[4]['colorname']='GREEN';
$color[4]['colorcode']='#008000';

$color[5]['colorname']='BLACK';
$color[5]['colorcode']='#000000';

$color[6]['colorname']='WHITE';
$color[6]['colorcode']='#FFFFFF';

$color[7]['colorname']='ORANGE';
$color[7]['colorcode']='#FFA000';

$color[8]['colorname']='VIOLET';
$color[8]['colorcode']='#F080F0';

$color[9]['colorname']='AQUA';
$color[9]['colorcode']='#00FFFF';

$color[10]['colorname']='GOLD';
$color[10]['colorcode']='#FFD800';

$color[11]['colorname']='GRAY';
$color[11]['colorcode']='#808080';

$color[12]['colorname']='GREY';
$color[12]['colorcode']='#808080';

$color[13]['colorname']='NAVYBLUE';
$color[13]['colorcode']='#A0B0E0';

$color[14]['colorname']='PURPLE';
$color[14]['colorcode']='#800080';

$color[15]['colorname']='IVORY';
$color[15]['colorcode']='#FFFFF0';

$color[16]['colorname']='PINK';
$color[16]['colorcode']='#FFC0C0';

$color[17]['colorname']='LIGHTBLUE';
$color[17]['colorcode']='#B0D8E0';

$color[18]['colorname']='BROWN';
$color[18]['colorcode']='#A02820';

$color[19]['colorname']='LIGHTGREEN';
$color[19]['colorcode']='#90F090';

$color[20]['colorname']='DARKBLUE';
$color[20]['colorcode']='#000080';

$color[21]['colorname']='LIGHTPINK';
$color[21]['colorcode']='#FFB8C0';

$color[22]['colorname']='DARKGREEN';
$color[22]['colorcode']='#006000';

$color[23]['colorname']='DARKRED';
$color[23]['colorcode']='#800000' ;

$color[24]['colorname']='LIGHTYELLOW';
$color[24]['colorcode']='#FFFFE0';

?>


3) Open function.php

in the function viewbbcode($message); , look for return substr($message, 1);

Paste the below before -> return substr($message, 1);

Code:
    // Font colours
    $bb_tpl['color_open']   =  "<span style=\"color: {COLOR_CODE}\">";
    $bb_tpl['color_close']  =  "</span>";
    $bb_tpl['color_open'] = str_replace('{COLOR_CODE}', '\\1', $bb_tpl['color_open']);
    $message = preg_replace("/\[color=(\#[0-9A-F]{6}|[a-z]+)\]/si", $bb_tpl['color_open'], $message);
    $message = str_replace("[/color]", "</span>", $message);


4) Open formsubmit.tpl insert this before </div>. Should be somewhere between line 55 & 56.

Code:
                    <select style="background-color:none" name="addbbcode18" onChange="bbfontstyle('[color=' + this.form.addbbcode18.options[this.form.addbbcode18.selectedIndex].value + ']', '[/color]');this.selectedIndex=0;" onMouseOver="helpline('s')">
                      <option class="options" style="color:#606060; background-color:#606060" value="{L_DEFAULT}" title="{L_DEFAULT}">{L_DEFAULT}</option>
                    <!-- BEGIN coloroptions -->
                      <option style="color:{coloroptions.CLR_CODE}; background-color:{coloroptions.CLR_CODE}" value="{coloroptions.CLR_CODE}" title="{coloroptions.CLR_NAME}">{coloroptions.CLR_NAME}</option>
                    <!-- END coloroptions -->


4) Open add.php & edit.php

add below into both file just before ->if (isset($_POST["preview"])){


Code:
include ($mybloggie_root_path.'includes/color-list.php');
for ($i=1; $i<($no_of_colors+1); $i++) {
 $template->assign_block_vars('coloroptions', array(
          'CLR_CODE'        => $color[$i]['colorcode'],
          'CLR_NAME'        => $color[$i]['colorname'],
          ));
}


YOU SHOULD BE ON YOUR WAY... YEP YOU ARE DONE

Try it & feedback in there is any problem
Back to top
View user's profile Send private message Send e-mail
mostho
Newbie


Joined: 03 Jun 2006
Posts: 6

PostPosted: Mon Jun 12, 2006 4:49 pm    Post subject: Yestested. Some feedback! Reply with quote

Hello Sean,
inserted in Mybloggie beta and previous and it works!

Some feedback:
1)
I took some time to find where is the color field chooser:
To improve usability please write in that fields something like the other choosers [COLOR] or [COL] also when it is not choosed. It's a lot easier and more noticeable.

2) there is a tiny error, a redundance:
I find two similar colors: GRAY and GREY with the same hex color chooser.

So solutions are
a) to choose two different kinda greys like i did
(light grey 808080, dark grey 363636). It's simple and I modified the code by myself in color-list.php
b) cut away one gray.

Obviously, I prefer the previous solution. More colours more fun and it's so simple to customize personal colors.

So Sean, c'mon and hold on tight on this cool project. As I can test I can help you. When yoiu need an italian translation consider me first. This can expand your excellent script.
I'm still consider to modify and customize deeply more on my sites. You will know ASAP.

My sites currently running with your scripts are:
www.wineandpleasure.com
www.geneburricca.it/blog/
www.bramatobros.com/brother/
www.bramatobros.com/sister/


Yeah dude, still consider me for this kinda testing and more.
And when you will do the links on Titles I will donate to you 20US$ for friendships.
Feel free to write me anytime!

Ciao,
Stefano
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    myWebland Forum Index -> Customization All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
TNX?

Error. Page cannot be displayed. Please contact your service provider for more details. (5)




Powered by phpBB © 2001, 2005 phpBB Group
Contact Us