• 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!

MyACC how to add ahref to a player character page in highscores

Solution
This is the original from latest myaac
PHP:
<a href="' . getPlayerLink($player['name'], false) . '">
    <span style="color: ' . ($player['online'] > 0 ? 'green' : 'red') . '">' . $player['name'] . '</span>
</a>';
You made some really weird code here, whats the goal?? I'm assuming you want to change the color between white and #00ff00, instead of green and red.
To my knowledge there is no html element called font, you need to change style for <span> element
Change line 247-251
From:
PHP:
echo '
            <td>
                <a href="' . getPlayerLink($player['name'], false) . '">
                <a style="font-size: 11px; text-shadow: black 0.2em 0.2em 0.4em; text-decoration:none;"><font color="' . ($player['online'] > 0 ? '#00ff00' ...
Line 249 and 250, there are two open "a" tags, one without href, and only one closing "a" tag.

<a href="' . getPlayerLink($player['name'], false) . '">

You need to find out what this function returns and alter it. Otherwise, you can skip the function and just input it yourself.

For example, if the page you want to go to is characterprofile.php or whatever, just change it to this:

Lua:
<a href="characterprofile.php?name=' . $player['name'] . '">
 
Last edited by a moderator:
Line 249 and 250, there are two open "a" tags, one without href, and only one closing "a" tag.

<a href="' . getPlayerLink($player['name'], false) . '">

You need to find out what this function returns and alter it. Otherwise, you can skip the function and just input it yourself.

For example, if the page you want to go to is characterprofile.php or whatever, just change it to this:

Lua:
<a href="characterprofile.php?name=' . $player['name'] . '">
nop still doesnt transfer him to his character profile
 
I'm unfamiliar with MyAcc, but I've just been on the demo page and the character profiles are structured like this:

-http://demo.my-aac.org/characters/Whorthnes

so based on that, change the a link to:

HTML:
<a href="characters/' . $player['name'] . '">
 
I'm unfamiliar with MyAcc, but I've just been on the demo page and the character profiles are structured like this:

-http://demo.my-aac.org/characters/Whorthnes

so based on that, change the a link to:

HTML:
<a href="characters/' . $player['name'] . '">
same
 
This is the original from latest myaac
PHP:
<a href="' . getPlayerLink($player['name'], false) . '">
    <span style="color: ' . ($player['online'] > 0 ? 'green' : 'red') . '">' . $player['name'] . '</span>
</a>';
You made some really weird code here, whats the goal?? I'm assuming you want to change the color between white and #00ff00, instead of green and red.
To my knowledge there is no html element called font, you need to change style for <span> element
Change line 247-251
From:
PHP:
echo '
            <td>
                <a href="' . getPlayerLink($player['name'], false) . '">
                <a style="font-size: 11px; text-shadow: black 0.2em 0.2em 0.4em; text-decoration:none;"><font color="' . ($player['online'] > 0 ? '#00ff00' : 'white') . '">' . $player['name'] . '</font>
                </a>';
To:
PHP:
echo '
    <a href="' . getPlayerLink($player['name'], false) . '">
                    <span style="font-size: 11px; text-shadow: black 0.2em 0.2em 0.4em; text-decoration:none; color: ' . ($player['online'] > 0 ? '#00ff00' : 'white') . '">' . $player['name'] . '</span>
                </a>';
 
Solution
The only problem is that you are opening 2 ahref tag, and you add the redirect to the 1st one, but the second tag is taking priority without having a reference to send the click. It is not good practice to use tags like <font> in the middle of your html code.
Below you have the php and css code for the classes.

Replace this snippet on lines 249/250 and 251:
PHP:
<a href="' . getPlayerLink($player['name'], false) . '">
    <a style="font-size: 11px; text-shadow: black 0.2em 0.2em 0.4em; text-decoration:none;"><font color="' . ($player['online'] > 0 ? '#00ff00' : 'white') . '">' . $player['name'] . '</font>
</a>';

So:
PHP:
// PHP
<a href="' . getPlayerLink($player['name'], false) . '" class="character-highscores ' . ($player['online'] > 0 ? 'color-green' : 'color-white') . '"> 
    ' . $player['name'] . ' 
</a>;

And add this to your main css file:
CSS:
.character-highscores {
  font-size: 11px;
  text-shadow: black 0.2em 0.2em 0.4em;
  text-decoration:none;
}

.color-green {
  color: #00ff00;
}

.color-white {
  color: #ffffff;
}
 
Back
Top