• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Php how to make path into character information. And color

Lopaskurwa

Active Member
Joined
Oct 6, 2017
Messages
884
Solutions
2
Reaction score
49
Hi
i have two questions. First one how to make a path on this line when you press on player name
PHP:
                        foreach(getTopPlayers(5) as $player)
                        {
                        echo '<li class="bg6"><href="' . getPlayerLink($player['name'], false) . '"  class="link2">' . truncate($player['name'],8) . '</a>';
                        echo '<class="style2"> lvl: <b>' . $player['level'] . '</b></li>';
                        }
It should go to his character information page
Second question, how to add color with php? lets say i want text "lvl:" to be red
 
Solution
HTML:
<style type="text/css">
    li.bg6 {
        background-color: green;
    }
    li > span.style2 {
        color: red;
    }
    li > a.style2 {
        color: blue;
    }
</style>
PHP:
<?php foreach(getTopPlayers(5) as $player): ?>
    <li class="bg6">
        <a href="<?= getPlayerLink($player['name'], false); ?>"  class="link2"><?= truncate($player['name'],8); ?></a>
        <span class="style2"> lvl:</span> <b><?= $player['level']; ?></b>
    </li>
<?php endforeach; ?>
PHP:
                        foreach(getTopPlayers(5) as $player)
                        {
                        echo '<li class="bg6"><a href="' . getPlayerLink($player['name'], false) . '"  class="link2">' . truncate($player['name'],8) . '</a>';
                        echo '<span class="style2"> lvl:</span> <b>' . $player['level'] . '</b></li>';
                        }


If the classes styles2 and link2 already exist, that should work.
 
PHP:
                        foreach(getTopPlayers(5) as $player)
                        {
                        echo '<li class="bg6"><a href="' . getPlayerLink($player['name'], false) . '"  class="link2">' . truncate($player['name'],8) . '</a>';
                        echo '<span class="style2"> lvl:</span> <b>' . $player['level'] . '</b></li>';
                        }


If the classes styles2 and link2 already exist, that should work.
Hmm? You are talking about css styles? If yes they dont exist i have no idea why this echo even have style2 but if i try to add color to it doesnt apply.
 
HTML:
<style type="text/css">
    li.bg6 {
        background-color: green;
    }
    li > span.style2 {
        color: red;
    }
    li > a.style2 {
        color: blue;
    }
</style>
PHP:
<?php foreach(getTopPlayers(5) as $player): ?>
    <li class="bg6">
        <a href="<?= getPlayerLink($player['name'], false); ?>"  class="link2"><?= truncate($player['name'],8); ?></a>
        <span class="style2"> lvl:</span> <b><?= $player['level']; ?></b>
    </li>
<?php endforeach; ?>
 
Solution
HTML:
<style type="text/css">
    li.bg6 {
        background-color: green;
    }
    li > span.style2 {
        color: red;
    }
    li > a.style2 {
        color: blue;
    }
</style>
PHP:
<?php foreach(getTopPlayers(5) as $player): ?>
    <li class="bg6">
        <a href="<?= getPlayerLink($player['name'], false); ?>"  class="link2"><?= truncate($player['name'],8); ?></a>
        <span class="style2"> lvl:</span> <b><?= $player['level']; ?></b>
    </li>
<?php endforeach; ?>
Perfection, maybe you know which one of these commands gave underline? I would like to remove it.
 
No problem. If you want to add an underline, just wrap the text in <u></u> HTML tags

I think he asked for remove underline from the link what you put on "clicking on player" when you hover mouse on link (path to player site) the underline appears.
 
No problem. If you want to add an underline, just wrap the text in <u></u> HTML tags
I think he asked for remove underline from the link what you put on "clicking on player" when you hover mouse on link (path to player site) the underline appears.
In this situation underline appears without hovering the mouse but if you hover mouse on that link it removes underline. Maybe that underline made in css?
 
Back
Top