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

[Znote AAC] Most powerful guilds (TFS 0.3/4 and 1.0)

you have to make a folder inside your www folder called images and other inside it called medals and put the medal's images there and it should work.
 
Is this right because its not on my page at all

PHP:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
    if ($config['allowSubPages'] && file_exists("layout/sub/index.php")) include 'layout/sub/index.php';
    else {
        $cache = new Cache('engine/cache/news');
        if ($cache->hasExpired()) {
            $news = fetchAllNews();
           
            $cache->setContent($news);
            $cache->save();
        } else {
            $news = $cache->load();
        }
       
        // Design and present the list
        if ($news) {
            function TransformToBBCode($string) {
                $tags = array(
                    '[center]{$1}[/center]' => '<center>$1</center>',
                    '[b]{$1}[/b]' => '<b>$1</b>',
                    '[size={$1}]{$2}[/size]' => '<font size="$1">$2</font>',
                    '[img]{$1}[/img]'    => '<a href="$1" target="_BLANK"><img src="$1" alt="image" style="width: 100%"></a>',
                    '[link]{$1}[/link]'    => '<a href="$1">$1</a>',
                    '[link={$1}]{$2}[/link]'  => '<a href="$1" target="_BLANK">$2</a>',
                    '[color={$1}]{$2}[/color]' => '<font color="$1">$2</font>',
                    '[*]{$1}[/*]' => '<li>$1</li>',
                );
                foreach ($tags as $tag => $value) {
                    $code = preg_replace('/placeholder([0-9]+)/', '(.*?)', preg_quote(preg_replace('/\{\$([0-9]+)\}/', 'placeholder$1', $tag), '/'));
                    $string = preg_replace('/'.$code.'/i', $value, $string);
                }
                        return $string;
            }
                    // Most powerful guilds for TFS 0.3/4 and 1.0
////////////////////////
// Create a cache file to avoid high SQL load
$cache = new Cache('engine/cache/guilds');
if ($cache->hasExpired()) {
    // Fetch guild data
 
if ($config['TFSVersion'] == 'TFS_03') $guilds = mysql_select_multi('SELECT `g`.`id` AS `id`, `g`.`name` AS `name`, COUNT(`g`.`name`) as `frags` FROM `killers` k LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id` LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id` LEFT JOIN `guild_ranks` gr ON `p`.`rank_id` = `gr`.`id` LEFT JOIN `guilds` g ON `gr`.`guild_id` = `g`.`id` WHERE `k`.`unjustified` = 1 AND `k`.`final_hit` = 1 GROUP BY `name` ORDER BY `frags` DESC, `name` ASC LIMIT 0, 3;');
elseif ($config['TFSVersion'] == 'TFS_10') $guilds = mysql_select_multi('SELECT `g`.`id` AS `id`, `g`.`name` AS `name`, COUNT(`g`.`name`) as `frags` FROM `players` p LEFT JOIN `player_deaths` pd ON `pd`.`killed_by` = `p`.`name` LEFT JOIN `guild_membership` gm ON `p`.`id` = `gm`.`player_id` LEFT JOIN `guilds` g ON `gm`.`guild_id` = `g`.`id` WHERE `pd`.`unjustified` = 1 GROUP BY `name` ORDER BY `frags` DESC, `name` ASC LIMIT 0, 3;');
    $cache->setContent($guilds);
    $cache->save();
} else {
    $guilds = $cache->load();
}
if (!empty($guilds) || !$guilds) {
    $divsize = 400;
    ?>
    <!-- No table design -->
    <center><h1>Most powerful guilds</h1></center>
    <div style="margin: auto; width: <?php echo $divsize; ?>px;">
        <?php
        $number = 1;
        foreach ($guilds as $guild) {
            ?>
            <div style="float: left; width: <?php echo (int)$divsize / 3; ?>px;">
                <a href="guilds.php?name=<?php echo $guild['name']; ?>"><img style="max-width: <?php echo (int)$divsize / 3; ?>px;" src="medals/<?php echo $number; ?>.png" alt="<?php echo $number; ?>"><br>
                <center><b><?php echo $guild['name']; ?></b><br>
                Kills: <?php echo $guild['frags']; ?></center></a>
            </div>
            <?php
            $number++;
        }
        ?>
    </div>
    <!-- With table design -->
    <table id="news">
        <tr class="yellow">
            <td class="zheadline"><center><b>Most powerful guilds</b></center></td>
        </tr>
        <tr>
            <td>
                <div style="margin: auto; width: <?php echo $divsize; ?>px;">
                    <?php
                  $number = 1;
                  foreach ($guilds as $guild) {
                      ?>
                      <div style="float: left; width: <?php echo (int)$divsize / 3; ?>px;">
                          <a href="guilds.php?name=<?php echo $guild['name']; ?>"><img style="max-width: <?php echo (int)$divsize / 3; ?>px;" src="medals/<?php echo $number; ?>.png" alt="<?php echo $number; ?>"><br>
                          <center><b><?php echo $guild['name']; ?></b><br>
                          Kills: <?php echo $guild['frags']; ?></center></a>
                      </div>
                      <?php
                      $number++;
                  }
                  ?>
              </div>
            </td>
        </tr>
    </table>
<?php
}
// End powerful guilds
            foreach ($news as $n) {
                ?>
                <table id="news">
                    <tr class="yellow">
                        <td class="zheadline"><?php echo date($config['date'], $n['date']) .' by <a href="characterprofile.php?name='. $n['name'] .'">'. $n['name'] .'</a> - <b>'. TransformToBBCode($n['title']) .'</b>'; ?></td>
                    </tr>
                    <tr>
                        <td>
                            <p><?php echo TransformToBBCode(nl2br($n['text'])); ?></p>
                        </td>
                    </tr>
                </table>
                <?php
            }
        } else {
            echo '<p>No news exist.</p>';
        }
    }
include 'layout/overall/footer.php'; ?>
 
@wikutag If you use a custom layout like tibiacom you probably need to edit the custom news file /layout/sub/index.php
 
@Znote

I'm using the original layout, and it doesn't show up at the front page..

index.php:

Code:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
    if ($config['allowSubPages'] && file_exists("layout/sub/index.php")) include

'layout/sub/index.php';
    else {
        $cache = new Cache('engine/cache/news');
        if ($cache->hasExpired()) {
            $news = fetchAllNews();
         
            $cache->setContent($news);
            $cache->save();
        } else {
            $news = $cache->load();
        }
     
        // Design and present the list
        if ($news) {
            function TransformToBBCode($string) {
                $tags = array(
                    '[center]{$1}[/center]' => '<center>$1</center>',
                    '[b]{$1}[/b]' => '<b>$1</b>',
                    '[size={$1}]{$2}[/size]' => '<font size="$1">$2</font>',
                    '[img]{$1}[/img]'    => '<a href="$1" target="_BLANK"><img src="$1"

alt="image" style="width: 100%"></a>',
                    '[link]{$1}[/link]'    => '<a href="$1">$1</a>',
                    '[link={$1}]{$2}[/link]'  => '<a href="$1" target="_BLANK">$2</a>',
                    '[color={$1}]{$2}[/color]' => '<font color="$1">$2</font>',
                    '[*]{$1}[/*]' => '<li>$1</li>',
                );
                foreach ($tags as $tag => $value) {
                    $code = preg_replace('/placeholder([0-9]+)/', '(.*?)', preg_quote

(preg_replace('/\{\$([0-9]+)\}/', 'placeholder$1', $tag), '/'));
                    $string = preg_replace('/'.$code.'/i', $value, $string);
                }
                        return $string;
            }
                    // Most powerful guilds for TFS 0.3/4 and 1.0
////////////////////////
// Create a cache file to avoid high SQL load
$cache = new Cache('engine/cache/guilds');
if ($cache->hasExpired()) {
    // Fetch guild data
if ($config['TFSVersion'] == 'TFS_03') $guilds = mysql_select_multi('SELECT `g`.`id` AS `id`,

`g`.`name` AS `name`, COUNT(`g`.`name`) as `frags` FROM `killers` k LEFT JOIN `player_killers`

pk ON `k`.`id` = `pk`.`kill_id` LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id` LEFT JOIN

`guild_ranks` gr ON `p`.`rank_id` = `gr`.`id` LEFT JOIN `guilds` g ON `gr`.`guild_id` =

`g`.`id` WHERE `k`.`unjustified` = 1 AND `k`.`final_hit` = 1 GROUP BY `name` ORDER BY `frags`

DESC, `name` ASC LIMIT 0, 3;');
elseif ($config['TFSVersion'] == 'TFS_10') $guilds = mysql_select_multi('SELECT `g`.`id` AS

`id`, `g`.`name` AS `name`, COUNT(`g`.`name`) as `frags` FROM `players` p LEFT JOIN

`player_deaths` pd ON `pd`.`killed_by` = `p`.`name` LEFT JOIN `guild_membership` gm ON

`p`.`id` = `gm`.`player_id` LEFT JOIN `guilds` g ON `gm`.`guild_id` = `g`.`id` WHERE

`pd`.`unjustified` = 1 GROUP BY `name` ORDER BY `frags` DESC, `name` ASC LIMIT 0, 3;');
    $cache->setContent($guilds);
    $cache->save();
} else {
    $guilds = $cache->load();
}
if (!empty($guilds) || !$guilds) {
    $divsize = 400;
    ?>
    <!-- No table design -->
    <center><h1>Most powerful guilds</h1></center>
    <div style="margin: auto; width: <?php echo $divsize; ?>px;">
        <?php
        $number = 1;
        foreach ($guilds as $guild) {
            ?>
            <div style="float: left; width: <?php echo (int)$divsize / 3; ?>px;">
                <a href="guilds.php?name=<?php echo $guild['name']; ?>"><img style="max-width:

<?php echo (int)$divsize / 3; ?>px;" src="medals/<?php echo $number; ?>.png" alt="<?php echo

$number; ?>"><br>
                <center><b><?php echo $guild['name']; ?></b><br>
                Kills: <?php echo $guild['frags']; ?></center></a>
            </div>
            <?php
            $number++;
        }
        ?>
    </div>
    <!-- With table design -->
    <table id="news">
        <tr class="yellow">
            <td class="zheadline"><center><b>Most powerful guilds</b></center></td>
        </tr>
        <tr>
            <td>
                <div style="margin: auto; width: <?php echo $divsize; ?>px;">
                    <?php
                  $number = 1;
                  foreach ($guilds as $guild) {
                      ?>
                      <div style="float: left; width: <?php echo (int)$divsize / 3; ?>px;">
                          <a href="guilds.php?name=<?php echo $guild['name']; ?>"><img

style="max-width: <?php echo (int)$divsize / 3; ?>px;" src="medals/<?php echo $number; ?>.png"

alt="<?php echo $number; ?>"><br>
                          <center><b><?php echo $guild['name']; ?></b><br>
                          Kills: <?php echo $guild['frags']; ?></center></a>
                      </div>
                      <?php
                      $number++;
                  }
                  ?>
              </div>
            </td>
        </tr>
    </table>
<?php
}
// End powerful guilds
            foreach ($news as $n) {
                ?>
                <table id="news">
                    <tr class="yellow">
                        <td class="zheadline"><?php echo date($config['date'], $n['date']) .'

by <a href="characterprofile.php?name='. $n['name'] .'">'. $n['name'] .'</a> - <b>'.

TransformToBBCode($n['title']) .'</b>'; ?></td>
                    </tr>
                    <tr>
                        <td>
                            <p><?php echo TransformToBBCode(nl2br($n['text'])); ?></p>
                        </td>
                    </tr>
                </table>
                <?php
            }
        } else {
            echo '<p>No news exist.</p>';
        }
    }
include 'layout/overall/footer.php'; ?>
 

You have to choose one of these inside the code, WITH TABLE DESIGNS OR WITHOUT TABLES DESING... here is with tables.

Code:
    <!-- With table design -->
    <table id="news">
        <tr class="yellow">
            <td class="zheadline"><center><b>Most powerful guilds</b></center></td>
        </tr>
        <tr>
            <td>
                <div style="margin: auto; width: <?php echo $divsize; ?>px;">
                    <?php
                  $number = 1;
                  foreach ($guilds as $guild) {
                      ?>
                      <div style="float: left; width: <?php echo (int)$divsize / 3; ?>px;">
                          <a href="guilds.php?name=<?php echo $guild['name']; ?>"><img

style="max-width: <?php echo (int)$divsize / 3; ?>px;" src="medals/<?php echo $number; ?>.png"

alt="<?php echo $number; ?>"><br>
                          <center><b><?php echo $guild['name']; ?></b><br>
                          Kills: <?php echo $guild['frags']; ?></center></a>
                      </div>
                      <?php
                      $number++;
                  }
                  ?>
              </div>
            </td>
        </tr>
    </table>
<?php
}
// End powerful guilds


If you put both it wont work.
 
@Tovar

I can't see anything on the page either way

Code:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
    if ($config['allowSubPages'] && file_exists("layout/sub/index.php")) include

'layout/sub/index.php';
    else {
        $cache = new Cache('engine/cache/news');
        if ($cache->hasExpired()) {
            $news = fetchAllNews();
         
            $cache->setContent($news);
            $cache->save();
        } else {
            $news = $cache->load();
        }
     
        // Design and present the list
        if ($news) {
            function TransformToBBCode($string) {
                $tags = array(
                    '[center]{$1}[/center]' => '<center>$1</center>',
                    '[b]{$1}[/b]' => '<b>$1</b>',
                    '[size={$1}]{$2}[/size]' => '<font size="$1">$2</font>',
                    '[img]{$1}[/img]'    => '<a href="$1" target="_BLANK"><img src="$1"

alt="image" style="width: 100%"></a>',
                    '[link]{$1}[/link]'    => '<a href="$1">$1</a>',
                    '[link={$1}]{$2}[/link]'  => '<a href="$1" target="_BLANK">$2</a>',
                    '[color={$1}]{$2}[/color]' => '<font color="$1">$2</font>',
                    '[*]{$1}[/*]' => '<li>$1</li>',
                );
                foreach ($tags as $tag => $value) {
                    $code = preg_replace('/placeholder([0-9]+)/', '(.*?)', preg_quote

(preg_replace('/\{\$([0-9]+)\}/', 'placeholder$1', $tag), '/'));
                    $string = preg_replace('/'.$code.'/i', $value, $string);
                }
                        return $string;
            }
// Most powerful guilds for TFS 0.3/4 and 1.0
////////////////////////
// Create a cache file to avoid high SQL load
$cache = new Cache('engine/cache/guilds');
if ($cache->hasExpired()) {
    // Fetch guild data
if ($config['TFSVersion'] == 'TFS_03') $guilds = mysql_select_multi('SELECT `g`.`id` AS `id`, 

`g`.`name` AS `name`, COUNT(`g`.`name`) as `frags` FROM `killers` k LEFT JOIN `player_killers` 

pk ON `k`.`id` = `pk`.`kill_id` LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id` LEFT JOIN 

`guild_ranks` gr ON `p`.`rank_id` = `gr`.`id` LEFT JOIN `guilds` g ON `gr`.`guild_id` = 

`g`.`id` WHERE `k`.`unjustified` = 1 AND `k`.`final_hit` = 1 GROUP BY `name` ORDER BY `frags` 

DESC, `name` ASC LIMIT 0, 3;');
elseif ($config['TFSVersion'] == 'TFS_10') $guilds = mysql_select_multi('SELECT `g`.`id` AS 

`id`, `g`.`name` AS `name`, COUNT(`g`.`name`) as `frags` FROM `players` p LEFT JOIN 

`player_deaths` pd ON `pd`.`killed_by` = `p`.`name` LEFT JOIN `guild_membership` gm ON 

`p`.`id` = `gm`.`player_id` LEFT JOIN `guilds` g ON `gm`.`guild_id` = `g`.`id` WHERE 

`pd`.`unjustified` = 1 GROUP BY `name` ORDER BY `frags` DESC, `name` ASC LIMIT 0, 3;');
    $cache->setContent($guilds);
    $cache->save();
} else {
    $guilds = $cache->load();
}
if (!empty($guilds) || !$guilds) {
    $divsize = 400;
    ?>
 <!-- With table design -->
    <table id="news">
        <tr class="yellow">
            <td class="zheadline"><center><b>Most powerful guilds</b></center></td>
        </tr>
        <tr>
            <td>
                <div style="margin: auto; width: <?php echo $divsize; ?>px;">
                    <?php
                  $number = 1;
                  foreach ($guilds as $guild) {
                      ?>
                      <div style="float: left; width: <?php echo (int)$divsize / 3; ?>px;">
                          <a href="guilds.php?name=<?php echo $guild['name']; ?>"><img

style="max-width: <?php echo (int)$divsize / 3; ?>px;" src="medals/<?php echo $number; ?>.png"

alt="<?php echo $number; ?>"><br>
                          <center><b><?php echo $guild['name']; ?></b><br>
                          Kills: <?php echo $guild['frags']; ?></center></a>
                      </div>
                      <?php
                      $number++;
                  }
                  ?>
              </div>
            </td>
        </tr>
    </table>
<?php
}
// End powerful guilds
            foreach ($news as $n) {
                ?>
                <table id="news">
                    <tr class="yellow">
                        <td class="zheadline"><?php echo date($config['date'], $n['date']) .'

by <a href="characterprofile.php?name='. $n['name'] .'">'. $n['name'] .'</a> - <b>'.

TransformToBBCode($n['title']) .'</b>'; ?></td>
                    </tr>
                    <tr>
                        <td>
                            <p><?php echo TransformToBBCode(nl2br($n['text'])); ?></p>
                        </td>
                    </tr>
                </table>
                <?php
            }
        } else {
            echo '<p>No news exist.</p>';
        }
    }
include 'layout/overall/footer.php'; ?>
 
I wonder if Znote has something against me... I've barely been on this forum except for this month...
I've sent him a PM 2 days ago... no reply, tagged him here etc. He's been at the forum plenty of times since then and he's been replying to another threads.

Thanks alot.
@Znote
 
@umbled
I'll look into my inbox when im not drunk :D
Don't worry, I have like 20 PMs in my inbox waiting for me to get sober. =D
 
Hello Znote
I followed your steps and at the end of them I get these errors:







If you can help me I would appreciate. Thanks for reading
 
Znote PLis help me pliis help me, im a beginner who started to make a server yesterday, now i need someone to explain how to make most powerful guilds plis help! write all steps and i will be very thanksful!
 
What is not working ? If it is not showing you maybe forget to create Guilds? To display this you must create a Guild.
 
hmm
Explain better to me and i will be very thanksful PLIS EXPLAIN IT OT ME AGAIN
GOOD EXPLAIN
 
Implent the code in your files like @Znote stated in his first post of this Thread. Then you will have to create Guilds to show them up at your Most Powerful Guild list.
 
Back
Top