• 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 castle war widget

jel

Member
Joined
Mar 22, 2014
Messages
302
Reaction score
12
Hi, I tried to change storage to the castle table, but it didn't work, any solution?
CREATE TABLE castle_war (
id int NOT NULL DEFAULT '0',
guild_id int NOT NULL,
guild_name varchar(64) NOT NULL,
timestamp int NOT NULL,
throne_points bigint NOT NULL DEFAULT '0',
active tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
Lua:
<?php if ($config['site']['widget_CastleWarBox']) { ?>
    <div id="CastleWarBox" class="Themebox"
         style="background-image:url(<?PHP echo "$layout_name"; ?>/images/themeboxes/chaoscastlhenews.png); margin-bottom:20px; height:110px;">
        <div style="padding-top:48px;">
            <div align="center" style="text-align:center;">
                <?php foreach ($SQL->query('SELECT `guild_name` FROM `castle_war` WHERE `active` = 1')->fetchAll() as $storage) {
                    if ($storage['value'] = 1) {
                        $guildId = $storage['value'];
                        break;
                    }
                }
                
                $guild = new Guild();
                $guild->loadById($guildId);
                if (!$guild)
                    $name = "";
                else
                    $name = $guild->getName();
                ?>
                <a class="topfont" style="font-size: .8em; position: absolute; top: 86px; left: 76px;">
                    <?php if ($guildId != 0) {
                        echo '<img style="position: absolute; top: -42px; left: -76px; border-radius: 7px;" src="guild_image.php?id=' . $guildId . '" width="64" height="64" border="0"/>';
                    } else {
                        echo 'Nenhuma guild.';
                    } ?>
                </a>
                <p>
                    <a href="?subtopic=castlewar"
                       style="background: transparent url(layouts/tibiarl/images/menu/fire.gif);font-size:14px;text-shadow: 0.1em 0.1em #333"
                       class="topfont">
                        <font color="white" style="font-size: 0.7em; position: relative; left: 32px; top: 34px;">Guild
                            Dominante<br></font>
                        <span style="font-size:12px;font-weight:bold">
                                                        <font color="#fc3"
                                                              style="position: absolute; top: 80px; left: 85px;"><?php echo $name; ?></font>
                                                        </span>
                    </a>
                </p>
            </div>
        </div>
    </div>
<?php } ?>
 
try.

PHP:
<?php if ($config['site']['widget_CastleWarBox']) { ?>
    <div id="CastleWarBox" class="Themebox" style="background-image:url(<?PHP echo "$layout_name"; ?>/images/themeboxes/chaoscastlhenews.png); margin-bottom:20px; height:110px;">
        <div style="padding-top:48px;">
            <div align="center" style="text-align:center;">
                <?php
                $stmt = $SQL->prepare('SELECT `guild_name` FROM `castle_war` WHERE `active` = 1');
                $stmt->execute();
                $result = $stmt->fetch(PDO::FETCH_ASSOC);

                if ($result) {
                    $guildName = $result['guild_name'];
                } else {
                    $guildName = 'Nenhuma guilda.';
                }
                ?>
                <a class="topfont" style="font-size: .8em; position: absolute; top: 86px; left: 76px;">
                    <?php
                    if ($result) {
                        $guildId = $result['value'];
                        echo '<img style="position: absolute; top: -42px; left: -76px; border-radius: 7px;" src="guild_image.php?id=' . $guildId . '" width="64" height="64" border="0"/>';
                    }
                    ?>
                </a>
                <p>
                    <a href="?subtopic=castlewar" style="background: transparent url(layouts/tibiarl/images/menu/fire.gif);font-size:14px;text-shadow: 0.1em 0.1em #333" class="topfont">
                        <font color="white" style="font-size: 0.7em; position: relative; left: 32px; top: 34px;">Guilda Dominante<br></font>
                        <span style="font-size:12px;font-weight:bold">
                            <font color="#fc3" style="position: absolute; top: 80px; left: 85px;"><?php echo $guildName; ?></font>
                        </span>
                    </a>
                </p>
            </div>
        </div>
    </div>
<?php } ?>
 
try.

PHP:
<?php if ($config['site']['widget_CastleWarBox']) { ?>
    <div id="CastleWarBox" class="Themebox" style="background-image:url(<?PHP echo "$layout_name"; ?>/images/themeboxes/chaoscastlhenews.png); margin-bottom:20px; height:110px;">
        <div style="padding-top:48px;">
            <div align="center" style="text-align:center;">
                <?php
                $stmt = $SQL->prepare('SELECT `guild_name` FROM `castle_war` WHERE `active` = 1');
                $stmt->execute();
                $result = $stmt->fetch(PDO::FETCH_ASSOC);

                if ($result) {
                    $guildName = $result['guild_name'];
                } else {
                    $guildName = 'Nenhuma guilda.';
                }
                ?>
                <a class="topfont" style="font-size: .8em; position: absolute; top: 86px; left: 76px;">
                    <?php
                    if ($result) {
                        $guildId = $result['value'];
                        echo '<img style="position: absolute; top: -42px; left: -76px; border-radius: 7px;" src="guild_image.php?id=' . $guildId . '" width="64" height="64" border="0"/>';
                    }
                    ?>
                </a>
                <p>
                    <a href="?subtopic=castlewar" style="background: transparent url(layouts/tibiarl/images/menu/fire.gif);font-size:14px;text-shadow: 0.1em 0.1em #333" class="topfont">
                        <font color="white" style="font-size: 0.7em; position: relative; left: 32px; top: 34px;">Guilda Dominante<br></font>
                        <span style="font-size:12px;font-weight:bold">
                            <font color="#fc3" style="position: absolute; top: 80px; left: 85px;"><?php echo $guildName; ?></font>
                        </span>
                    </a>
                </p>
            </div>
        </div>
    </div>
<?php } ?>
It's working fine, it just doesn't show the guild image
 
Back
Top