vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   ~ Usernames Appearance ~ (https://vborg.vbsupport.ru/showthread.php?t=143862)

MrPeace 04-02-2007 03:04 PM

~ Usernames Appearance ~
 
Hi All,

I was wondering if there was any way in which i could make the username with each letter differant colors..? I had a look at it and couldnt think of a way of doing this, if any of you guys know of a way or can produce a way i would greatly appreciate it.

Thanks.

WetWired 04-02-2007 03:33 PM

Only way I can think of is javascript that looks for certain markup and adds its own.

MrPeace 04-03-2007 04:28 AM

Quote:

Originally Posted by WetWired (Post 1218414)
Only way I can think of is javascript that looks for certain markup and adds its own.


Thanks for replying m8.... how exactly would that work tho ? im pretty new when it comes to working with javascript

WetWired 04-03-2007 12:47 PM

Myself, I've never written anything like that, but what you need to do is put something like <span class="rainbow"></span> as the markup for the usergroup, then have javascript that runs at the end that does a document.getElementsByTagName("span") to get all the spans, then itterate through them. For each one with className="rainbow", you'd retrieve the innerHTML, break it into letters, add the color markup, and write it back.

Again, I'm a novice when it comes to JS, especially the string stuff you'd need to use; if what I've given you isn't enough, you'll need to find other help.

cOuNtErFiET 04-10-2007 06:56 AM

i know what your talking about chris and yea i was wondering the same thing
so far i havent found a way but im still looking, i see it a lot on the ipb board but havent seen it yet on a vb board

EDIT: found out how and got it working on my board!

magnus 04-10-2007 05:19 PM

Well, no.. this could be done in PHP, too.

PHP Code:

<?
$colors = array(
    'a' => 'red',
    'b' => 'blue',
    'c' => 'green',
    'd' => '#CFCFCD',

    etc ..
);

$input = 'abcdefghi..';
$letters = preg_split('//', $input -1, PREG_SPLIT_NO_EMPTY);

foreach($letters as $letter)
{
    echo '<span style="font-color:' . $colors[$letter] . '">' . $letter . '</span>';
}

?>

Just an example, but it could be expanded on.. for example, make it a function and just call it whenever you want it.

PHP Code:

function omgcolors(text)
{
    
$letters preg_split('//'$text, -1PREG_SPLIT_NO_EMPTY);

    foreach(
$letters as $letter)
    {
        
$output .= '<span style="font-color:' $colors[$letter] . '">' $letter '</span>';
    }

    return 
$output;


Then you could just call it when needed.

ie.
Code:

omgcolors($bbusername);

Si... 04-10-2007 05:44 PM

Or you could use HTML. Depends. Do you want it on everyones username? Or just yours?

Oh and using html like that is not recommended... But its an idea.

Some Random Text

captainron19 04-10-2007 05:46 PM

On somewhat of a same note, is it possible to have usernames all show in a specific font? I have an odd font that a lot of people most likely do not have on their computer so I was wondering if it is possible if they do not have it loaded.

Si... 04-10-2007 05:48 PM

It may possible to Embed a font. But I couldn't tell you how to do that.

MrPeace 04-12-2007 06:54 PM

Quote:

Originally Posted by Si... (Post 1224331)
Or you could use HTML. Depends. Do you want it on everyones username? Or just yours?

Oh and using html like that is not recommended... But its an idea.

Some Random Text

No i would make it for a specific usergroup and hopefully be able to make others for differant usergroups


All times are GMT. The time now is 07:20 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01665 seconds
  • Memory Usage 1,740KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete