include("sisadmin/_conn.php");
if ($_GET['idNoticia']) {
$idNoticia = (int) mysql_real_escape_string($_GET['idNoticia']);
$compSql = "WHERE cod_noti = '$idNoticia'";
} else {
$compSql = "ORDER BY noti_data DESC";
}
$sqlNoticiasGet = "SELECT *,DATE_FORMAT(noti_data,'%d/%m/%Y') as dt_noticia
FROM noticias
$compSql
LIMIT 1
";
//echo "$sqlNoticiasGet";
$resNoticiasGet = mysql_query($sqlNoticiasGet) or die ("sqlNoticiasGet:
".mysql_error());
$qtdNoticiasGet = mysql_num_rows($resNoticiasGet);
$pntNoticiasGet = mysql_fetch_array($resNoticiasGet);
$idNoticia = $pntNoticiasGet['cod_noti'];
$tituloNoticia = $pntNoticiasGet['noti_titulo'];
$textoNoticia = nl2br($pntNoticiasGet['noti_texto']);
$fotoNoticia = $pntNoticiasGet['noti_fotocapa'];
$dataNoticia = $pntNoticiasGet['dt_noticia'];
$extensao = substr($fotoNoticia,-3);
if ($extensao == 'jpg') {
$img = imagecreatefromjpeg($fotoNoticia);
$imgX = imagesx($img);
} elseif ($extensao == 'gif') {
$img = imagecreatefromgif($fotoNoticia);
$imgX = imagesx($img);
} else {
$incompativel = 'sim';
}
if ($imgX > 220) {
$fotoArtigo = "_trataimagem.php?image=$fotoNoticia&max=220";
}
$fotoArtigoImg = "
";
if ($incompativel == 'sim') {
$fotoArtigoImg = "";
}
// ------------------------------------------------
$pg = addslashes($_GET['pg']);
$paginacao = "20";
if ($pg==''){
$pg = 1;
$inicial = $pg-1;
$inicial = $inicial*$paginacao;
} else {
$inicial = ($pg-1)*$paginacao;
}
//--------------------------------------------------
// CONTADOR
$sqlc = "SELECT * FROM noticias";
$rsc = mysql_query($sqlc);
$totalc = mysql_num_rows($rsc);
$pages = ceil($totalc/$paginacao);
if ($pages > 15) {
$qtdPaginacaoN = 15;
$pagesExibe = "...[".$pages."]";
} else {
$qtdPaginacaoN = $pages;
$pagesExibe = "";
}
//-----------------------------------------------
?>
require_once("_config.php");
?>
include("_topo.php"); ?>
 |
Notícias |
|
|
include("_rodape.php")?>