Noticias
$arrBusqueda = '';
foreach($_REQUEST as $key => $value){
if($key!='input_x' && $key!='input_y' && $key!='PHPSESSID'
&& $key!='input' && $key!='pagina')
$arrBusqueda .= '&'.$key.'='.$value;
}
if(!isset($_REQUEST['ord'])){ $_REQUEST['ord'] = 'DESC';}
elseif($_REQUEST['ordenacion']) {
if($_REQUEST['ord']=='ASC') $_REQUEST['ord'] = 'DESC';
elseif($_REQUEST['ord']=='DESC') $_REQUEST['ord'] = 'ASC';
}
?>
Ordenar por :
Título |
Fecha
-
require_once 'classes/class.Noticias.php';
include_once 'includes/functionsStrings.php';
$iTamanyPlana = 10;
$iPagina = 1;
if (isset($_GET['pagina'])) $iPagina = $_GET['pagina'];
if (!$iPagina) $iInicio = 0;
else $iInicio = ($iPagina - 1) * $iTamanyPlana;
if (!isset($_GET['order_by']) || $_GET['order_by'] == "") {
$_GET['order_by'] = "not_fecha";
$_REQUEST['ord'] = "DESC";
}
if ($_GET['order_by'] != "not_titular_es" && $_GET['order_by'] != "not_fecha") $_GET['order_by'] = "not_fecha";
if ($_REQUEST['ord'] != "" && $_REQUEST['ord'] != "DESC" && $_REQUEST['ord'] != "ASC") $_REQUEST['ord'] = "DESC";
if(isset($_GET['ordenacion'])) $ordenacion = ' ORDER BY '.$_GET['order_by'].' '.$_REQUEST['ord'];
else $ordenacion =' ORDER BY not_fecha DESC';
$objNoticias = new Noticias();
$sWhere = $ordenacion;
$objNoticias->Select();
$iTotalRegistros = $objNoticias->resultCount();
$iTotalPaginas = ceil($iTotalRegistros / $iTamanyPlana);
$objNoticias->__destruct();
$objNoticias = new Noticias();
$sWhere .= ' LIMIT '.$iInicio.','.$iTamanyPlana;
$objNoticias->Select($sWhere);
$iRegistrosPagina = count($objNoticias->record);
foreach($objNoticias->record as $key =>$arrNoticia){
$not_id = $arrNoticia['not_id'];
$not_fecha = tractardata($arrNoticia['not_fecha'],'YYYYMMDD_DDMMYYYY');
$not_titular = $arrNoticia['not_titular_'.$_SESSION['sIdioma']];
?>
- } $objNoticias->__destruct();?>
- if($iInicio == '0') echo $iRegistrosPagina; else echo $iRegistrosPagina + ($iTamanyPlana * ($iPagina - 1)); ?> de