cotonti.com : Problems with $cfg[] https://www.cotonti.com Last topic posts Cotonti en Sun, 21 Jun 2026 08:37:26 -0000 TwistedGA ]]> Wed, 08 Apr 2009 07:23:16 -0000 Elgan 1. //Added Function for User_Display Creation 2. function Split_String($namesplit) { G[color=#EF2929]global $cfg;[/color] 3. $STR_LEN = strlen($namesplit); 4. $newdisplay = ""; 5. for ($i = 0; $i < $STR_LEN; $i++) { 6. $newdisplay .= "<span style=\"color:#".$cfg['defaultcolor']."\">" . $namesplit{$i} . "</span>"; 7. } 8. return $newdisplay; 9. } 10. $displayname = "".$ruserdisplay.""; 11. //Added Function for User_Display Creation
red is what i added.


EDIT: it dindt show up right. Could colours work in codes? bug not meant to?

so, you need to add a global to call cfg. so
glboal cfg; before its needed will work. make sense? php.net may explain better.]]>
Wed, 08 Apr 2009 05:53:41 -0000
TwistedGA
I am able to echo
$cfg['defaultcolor']
into the page, but when I try to use it in the string I need to, it doesn't insert the value it echo's like I need it to. The code is below, any help at all would be greatly appreciated. It's really odd that it will echo to the page and but wont insert into the string.
//Added Function for User_Display Creation
function Split_String($namesplit) {
    $STR_LEN = strlen($namesplit);
    $newdisplay = "";
    for ($i = 0; $i < $STR_LEN; $i++) {
        $newdisplay .= "<span style=\"color:#".$cfg['defaultcolor']."\">" . $namesplit{$i} . "</span>";
    }
    return $newdisplay;
}
$displayname = "".$ruserdisplay."";
//Added Function for User_Display Creation
]]>
Wed, 08 Apr 2009 05:09:26 -0000