ShogS Posted August 5, 2012 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 91 Reputation: 8 Joined: 03/03/12 Last Seen: October 2, 2020 Share Posted August 5, 2012 (edited) <?php if (!defined('FLUX_ROOT')) exit; $title = 'Castles'; $sql = "SELECT castles.castle_id, castles.guild_id, guild.name AS guild_name, guild.emblem_len FROM {$server->charMapDatabase}.guild_castle AS castles "; $sql .= "LEFT JOIN guild ON guild.guild_id = castles.guild_id ORDER BY castles.castle_id ASC"; $sth = $server->connection->getStatement($sql); $sth->execute(); $castles = $sth->fetchAll(); $castleNames = Flux::config('CastleNames')->toArray(); ?> HOW can I put some Limits uppon showing the records of the castle owned. gusto ko kc 5 castle lang ang mag papakita every page. pano po ba? Like sa GUILD Rank 20 pano po malalagyan ng limits? Help Plss Edited August 5, 2012 by argelrock Quote Link to comment Share on other sites More sharing options...
Jupeto Posted August 5, 2012 Group: Members Topic Count: 34 Topics Per Day: 0.01 Content Count: 225 Reputation: 39 Joined: 01/20/12 Last Seen: October 6, 2024 Share Posted August 5, 2012 (edited) Look for $sql .= "LIMIT ".(int)Flux::config('LimitCastle'); Change to $sql .= "LIMIT 5"; EDIT: Yung guild ranking limit kasi nasa config/application.php so I think nandun din ung castle limit. kapag nandun ung LimitCastle na variable un na lang palitan mo para di mo na palitan tong line na to $sql .= "LIMIT ".(int)Flux::config('LimitCastle'); Edited August 5, 2012 by jupeto Quote Link to comment Share on other sites More sharing options...
ShogS Posted August 5, 2012 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 91 Reputation: 8 Joined: 03/03/12 Last Seen: October 2, 2020 Author Share Posted August 5, 2012 Look for $sql .= "LIMIT ".(int)Flux::config('LimitCastle'); Change to $sql .= "LIMIT 5"; EDIT: Yung guild ranking limit kasi nasa config/application.php so I think nandun din ung castle limit. kapag nandun ung LimitCastle na variable un na lang palitan mo para di mo na palitan tong line na to $sql .= "LIMIT ".(int)Flux::config('LimitCastle'); SIr sorry mali po post ko eto po pala ung Code <?php if (!defined('FLUX_ROOT')) exit; $title = 'Castles'; $sql = "SELECT castles.castle_id, castles.guild_id, guild.name AS guild_name, guild.emblem_len FROM {$server->charMapDatabase}.guild_castle AS castles "; $sql .= "LEFT JOIN guild ON guild.guild_id = castles.guild_id ORDER BY castles.castle_id ASC"; $sth = $server->connection->getStatement($sql); $sth->execute(); $castles = $sth->fetchAll(); $castleNames = Flux::config('CastleNames')->toArray(); ?> gusto ko sana lagyan ng Limit kaso pag sinubukan ko po ung -- $sql .= "LIMIT ".(int)Flux::config('LimitCastle'); at ung $sql .= "LIMIT 5"; hindi na po nag a apear ung mga records Quote Link to comment Share on other sites More sharing options...
Jupeto Posted August 5, 2012 Group: Members Topic Count: 34 Topics Per Day: 0.01 Content Count: 225 Reputation: 39 Joined: 01/20/12 Last Seen: October 6, 2024 Share Posted August 5, 2012 I see, in this case, kelangan mong itweak yung themes/your_theme_name/castle/index.php... ewan lang kung meron na jang existing code for that per ginagawan ko na ng script yun... di ka naman siguro nagmamadali hehe Quote Link to comment Share on other sites More sharing options...
ShogS Posted August 5, 2012 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 91 Reputation: 8 Joined: 03/03/12 Last Seen: October 2, 2020 Author Share Posted August 5, 2012 I see, in this case, kelangan mong itweak yung themes/your_theme_name/castle/index.php... ewan lang kung meron na jang existing code for that per ginagawan ko na ng script yun... di ka naman siguro nagmamadali hehe ^^ ok lang po.. I can wait. I hope you can help me po thanks in advance Quote Link to comment Share on other sites More sharing options...
Jupeto Posted August 5, 2012 Group: Members Topic Count: 34 Topics Per Day: 0.01 Content Count: 225 Reputation: 39 Joined: 01/20/12 Last Seen: October 6, 2024 Share Posted August 5, 2012 (edited) Got it working na without search function! final code below po, in modules/castle/index.php copy below and replace your current castle index code <?php if (!defined('FLUX_ROOT')) exit; $title = 'Castles'; // $sql = "SELECT castles.castle_id, castles.guild_id, guild.name AS guild_name, guild.emblem_len FROM {$server->charMapDatabase}.guild_castle AS castles "; // $sql .= "LEFT JOIN guild ON guild.guild_id = castles.guild_id ORDER BY castles.castle_id ASC"; // $sth = $server->connection->getStatement($sql); // $sth->execute(); $sql = "SELECT COUNT(castle_id) AS total FROM {$server->charMapDatabase}.guild_castle"; $sth = $server->connection->getStatement($sql); $sth->execute(); $paginator = $this->getPaginator($sth->fetch()->total,array('perPage'=>(int)Flux::config('CastleLimit'))); $sql = "SELECT castles.castle_id, castles.guild_id, guild.name AS guild_name, guild.emblem_len FROM {$server->charMapDatabase}.guild_castle AS castles "; $sql .= "LEFT JOIN guild ON guild.guild_id = castles.guild_id ORDER BY castles.castle_id ASC"; $sql = $paginator->getSQL($sql); $sth = $server->connection->getStatement($sql); $sth->execute(); $castles = $sth->fetchAll(); $castleNames = Flux::config('CastleNames')->toArray(); ?> save and exit. in themes/your_theme_name/castle/index.php copy below and replace your current castle index code <?php if (!defined('FLUX_ROOT')) exit; ?> <h2>Castles</h2> <p>This page shows what castles are activated and which guilds own them.</p> <?php if ($castles): ?> <?php echo $paginator->infoText() ?> <table class="vertical-table"> <tr> <th>Castle ID</th> <th>Castle</th> <th colspan="2">Guild</th> </tr> <?php foreach ($castles as $castle): ?> <tr> <td align="right"><?php echo htmlspecialchars($castle->castle_id) ?></td> <td> <?php if (array_key_exists($castle->castle_id, $castleNames) && $castleNames[$castle->castle_id]): ?> <?php echo htmlspecialchars($castleNames[$castle->castle_id]) ?> <?php else: ?> <span class="not-applicable">Unknown<?php echo " (".$castle->castle_id.")" ?></span> <?php endif ?> </td> <?php if ($castle->guild_name): ?> <?php if ($castle->emblem_len): ?> <td width="24"><img src="<?php echo $this->emblem($castle->guild_id) ?>" /></td> <td> <?php if ($auth->actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> <?php echo $this->linkToGuild($castle->guild_id, $castle->guild_name) ?> <?php else: ?> <?php echo htmlspecialchars($castle->guild_name) ?> <?php endif ?> </td> <?php else: ?> <td colspan="2"><?php echo htmlspecialchars($castle->guild_name) ?></td> <?php endif ?> <?php else: ?> <td colspan="2"><span class="not-applicable"><?php echo htmlspecialchars(Flux::message('NoneLabel')) ?></span></td> <?php endif ?> </tr> <?php endforeach ?> </table> <?php echo $paginator->getHTML() ?> <?php else: ?> <p>No castles found. <a href="javascript:history.go(-1)">Go back</a>.</p> <?php endif ?> save and exit. in lib/Flux/Paginator.php find public function infoText() { $currPage = $this->currentPage; $results = Flux::config('ResultsPerPage'); $infoText = sprintf( Flux::message('FoundSearchResults'), $this->total, $this->numberOfPages, ($currPage*$results-($results - 1)), $currPage * $results < $this->total ? ($currPage*$results) : ($this->total) ); return sprintf('<p class="info-text">%s</p>', $infoText); } change to public function infoText() { $currPage = $this->currentPage; // $results = Flux::config('ResultsPerPage'); $results = $this->perPage; $infoText = sprintf( Flux::message('FoundSearchResults'), $this->total, $this->numberOfPages, ($currPage*$results-($results - 1)), $currPage * $results < $this->total ? ($currPage*$results) : ($this->total) ); return sprintf('<p class="info-text">%s</p>', $infoText); } save and exit. in config/application.php find 'CharRankingLimit' => 10, // add above 'CastleLimit' => 5, // Number of castle limit result per page save and exit. now try your castle list Edited August 5, 2012 by jupeto 1 Quote Link to comment Share on other sites More sharing options...
ShogS Posted August 6, 2012 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 91 Reputation: 8 Joined: 03/03/12 Last Seen: October 2, 2020 Author Share Posted August 6, 2012 Got it working na without search function! final code below po, in modules/castle/index.php copy below and replace your current castle index code <?php if (!defined('FLUX_ROOT')) exit; $title = 'Castles'; // $sql = "SELECT castles.castle_id, castles.guild_id, guild.name AS guild_name, guild.emblem_len FROM {$server->charMapDatabase}.guild_castle AS castles "; // $sql .= "LEFT JOIN guild ON guild.guild_id = castles.guild_id ORDER BY castles.castle_id ASC"; // $sth = $server->connection->getStatement($sql); // $sth->execute(); $sql = "SELECT COUNT(castle_id) AS total FROM {$server->charMapDatabase}.guild_castle"; $sth = $server->connection->getStatement($sql); $sth->execute(); $paginator = $this->getPaginator($sth->fetch()->total,array('perPage'=>(int)Flux::config('CastleLimit'))); $sql = "SELECT castles.castle_id, castles.guild_id, guild.name AS guild_name, guild.emblem_len FROM {$server->charMapDatabase}.guild_castle AS castles "; $sql .= "LEFT JOIN guild ON guild.guild_id = castles.guild_id ORDER BY castles.castle_id ASC"; $sql = $paginator->getSQL($sql); $sth = $server->connection->getStatement($sql); $sth->execute(); $castles = $sth->fetchAll(); $castleNames = Flux::config('CastleNames')->toArray(); ?> save and exit. in themes/your_theme_name/castle/index.php copy below and replace your current castle index code <?php if (!defined('FLUX_ROOT')) exit; ?> <h2>Castles</h2> <p>This page shows what castles are activated and which guilds own them.</p> <?php if ($castles): ?> <?php echo $paginator->infoText() ?> <table class="vertical-table"> <tr> <th>Castle ID</th> <th>Castle</th> <th colspan="2">Guild</th> </tr> <?php foreach ($castles as $castle): ?> <tr> <td align="right"><?php echo htmlspecialchars($castle->castle_id) ?></td> <td> <?php if (array_key_exists($castle->castle_id, $castleNames) && $castleNames[$castle->castle_id]): ?> <?php echo htmlspecialchars($castleNames[$castle->castle_id]) ?> <?php else: ?> <span class="not-applicable">Unknown<?php echo " (".$castle->castle_id.")" ?></span> <?php endif ?> </td> <?php if ($castle->guild_name): ?> <?php if ($castle->emblem_len): ?> <td width="24"><img src="<?php echo $this->emblem($castle->guild_id) ?>" /></td> <td> <?php if ($auth->actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> <?php echo $this->linkToGuild($castle->guild_id, $castle->guild_name) ?> <?php else: ?> <?php echo htmlspecialchars($castle->guild_name) ?> <?php endif ?> </td> <?php else: ?> <td colspan="2"><?php echo htmlspecialchars($castle->guild_name) ?></td> <?php endif ?> <?php else: ?> <td colspan="2"><span class="not-applicable"><?php echo htmlspecialchars(Flux::message('NoneLabel')) ?></span></td> <?php endif ?> </tr> <?php endforeach ?> </table> <?php echo $paginator->getHTML() ?> <?php else: ?> <p>No castles found. <a href="javascript:history.go(-1)">Go back</a>.</p> <?php endif ?> save and exit. in lib/Flux/Paginator.php find public function infoText() { $currPage = $this->currentPage; $results = Flux::config('ResultsPerPage'); $infoText = sprintf( Flux::message('FoundSearchResults'), $this->total, $this->numberOfPages, ($currPage*$results-($results - 1)), $currPage * $results < $this->total ? ($currPage*$results) : ($this->total) ); return sprintf('<p class="info-text">%s</p>', $infoText); } change to public function infoText() { $currPage = $this->currentPage; // $results = Flux::config('ResultsPerPage'); $results = $this->perPage; $infoText = sprintf( Flux::message('FoundSearchResults'), $this->total, $this->numberOfPages, ($currPage*$results-($results - 1)), $currPage * $results < $this->total ? ($currPage*$results) : ($this->total) ); return sprintf('<p class="info-text">%s</p>', $infoText); } save and exit. in config/application.php find 'CharRankingLimit' => 10, // add above 'CastleLimit' => 5, // Number of castle limit result per page save and exit. now try your castle list Tnx sir. it works now ^^ more power Quote Link to comment Share on other sites More sharing options...
Jupeto Posted August 6, 2012 Group: Members Topic Count: 34 Topics Per Day: 0.01 Content Count: 225 Reputation: 39 Joined: 01/20/12 Last Seen: October 6, 2024 Share Posted August 6, 2012 Rep please Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.