ВАЖНО ЗА ВСИЧКИ ГОСТИ НА GAMERS FORUM

За да ползвате ликовете които са дадени в форума на този сайт, трябва да си направите нова регистрация Извиняваме се за създаденото не удобство, но се надяваме, че е за доброто на всички наши потребители!

guild mark > html code (php code)/Modules

Go down

guild mark > html code (php code)/Modules

Писане by admin on Сря 09 Фев 2011, 14:43

I kinda prefer html over gd2. So here is the function that should ease up the converting of guild logos to a regular display in your web page.

Note that this works with all php versions and does not require the gd2 php extension to be loaded( it has performance issues it is bigger in output size )

so i've created this little php function that should do the job and decided to share it

Create a file in your web root called sy_mark.php (for example) and fill the following code in it
Note that the code is well commented ^^
PHP Code:
/*

[ "MuMark to HTML" Script]
[ Author: Savoy]
[ savoy___@hotmail.com]

*/

// Create the function
function SYlogo($code,$xy=3) {

// Turn hex into dec
$code = urlencode(bin2hex($code));
$color[0] = ''; $color[1]='#000000'; $color[2]='#8c8a8d'; $color[3]='#ffffff'; $color[4]='#fe0000'; $color[5]='#ff8a00'; $color[6]='#ffff00'; $color[7]='#8cff01'; $color[8]='#00ff00'; $color[9]='#01ff8d'; $color['a']='#00ffff'; $color['b']='#008aff'; $color['c']='#0000fe'; $color['d']='#8c00ff'; $color['e']='#ff00fe'; $color['f']='#ff008c';

// Set the default zero position.
$i = 0;
$ii = 0;

// Create the table
$it = '';

// Start the logo drawing cycle for each color slot
while ($i<64) {

// Get the slot color number
$place = $code{$i};

// Increase the slot
$i ;$ii ;

// Get the color of the slot

$add = $color[$place];

// Create the slot with its color

$it .= '';

// In case we have a new line
if ($ii==Cool {
$it .= '';
if ($ii != 64) $it .='';
$ii =0;
}
}

// Finish the table off
$it .= '
';

// What do we output
return $it;
}
?>
How to use ? Its easy ..
just write down this in a file to test
PHP Code:
// Connect to database bullcrap - fill it in

require 'sy_mark.php';

$guild = 'TestGuildName'; // Change this to your guild name

// Using a regular query
$query = mssql_query("select [G_Mark] from [Guild] where [G_Name]='".$guild."'");
// Fetching the results as a dec array
$result = mssql_fetch_row($query);
// Fetching the first (& only) result - g_mark
$glogo = $result[0];

// Set a variable with the output text
$mylogo = SYlogo($glogo,3); // You can change 3 with the size (in pixels) you want each slot to have

// You want to display it ???
print $mylogo;

?>
*Tested and working, don't bother to post if you can't get it working - i've explained as well as i can*
avatar
admin
Admin
Admin

Age : 25
Брой мнения : 181
Points : 2147483647
Reputation : 0
Местожителство : silistra
Join date : 09.02.2010

http://gamers.forum-canada.net

Върнете се в началото Go down

Върнете се в началото

- Similar topics

 
Права за този форум:
Не Можете да отговаряте на темите