Skip to content

Instantly share code, notes, and snippets.

@matheusgimenez
Forked from anonymous/gist:8201006
Last active January 1, 2016 20:59
Show Gist options
  • Save matheusgimenez/8201047 to your computer and use it in GitHub Desktop.
Save matheusgimenez/8201047 to your computer and use it in GitHub Desktop.
<?php
require_once ( "inc/mysql.classe.php" );
require_once ( "inc/paginator.class.php" );
// Conexão
$MySQL = new MysqlConnect();
$MySQL->connect();
function noticiaspag() {
$connection = new PDO("mysql:dbname=".MYSQL_DATABASE.";host=" . MYSQL_IP, MYSQL_USUARIO, MYSQL_SENHA);
$sql = $connection->query("SELECT * FROM noticias ORDER BY id DESC");
return $sql->fetchAll(PDO::FETCH_ASSOC);
}
$paginator = new Paginator(noticiaspag(), 2);
$paginator->link = "index.php?send=noticias";
$i = 1;
if($_GET['page'] <= 1) :
$calculo_rank = $i;
else :
$calculo_rank = ($i + ($_GET['page'] * 2)) - 2;
endif;
?>
<div class="row" style="padding-top:140px;">
<?php foreach ($paginator->data() as $show) {
?>
<div class="large-4 small-12 columns news">
<a href="#">
<img src="<?php echo $show['imagem']; ?>" class="th">
</a><div class="large-12 medium-12 panel news"><a href="#">
<?php echo $show['titulo']; ?><br><br>
<b>Fonte: </b></a><a href="<?php echo $show['fontelink']; ?>" class="button tiny radius bt1"><?php echo $show['fonte']; ?></a>
</div>
</div>
<?php $i++;}?>
</div>
<table width="100%" border="0" cellspacing="3" cellpadding="0">
<tr>
<td width="1%">&nbsp;</td>
<td width="99%"><ul class="ul">
<?php echo $paginator->numbers(); ?>
</ul></td>
</tr>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment