include ("../mysql.php");
//-----------------------------------------------
if (mysql_connect($host,$user,$password)) {
}
//-------funciones------------------
function fechaformat($fecha){
$Mes=substr($fecha,5,2);
$Dia=substr($fecha,8,2);
$Any=substr($fecha,0,4);
$fecha=sprintf("%s/%s/%s",$Dia,$Mes,$Any);
return $fecha;
}
//---------------------fecha hoy----------------------
$Diay=date("d");
$Mesy=date("m");
$Anyoy=date("Y");
$Avui=sprintf("%s/%s/%s",$Anyoy,$Mesy,$Diay);
//--------------------------------------------------
function CortaString ($str,$NCar) {
//Devuelve el string con $NCar, sin cortar palabras, y con "..."
$i=1;
if (strlen($str)>$NCar) {
$str_aux=substr($str,0,$NCar);
while ($str_aux[strlen($str_aux)-$i]!=' ') {
$str_aux[strlen($str_aux)-$i]=' ';
$i++;
}
$str_aux.=" ...";
} else {
$str_aux=$str;
}
return $str_aux;
}
?>
Mas Evolucion Tunning
include("../plantillas/menu.php"); ?>
Novedades
$q=sprintf("select * from Noticia where Codnot>1 and Cod_categoria=2 and Fecha_fin>='$Avui' and Activo='Si' and Home='Si'");
$res=mysql_db_query ($db, $q);
if (mysql_num_rows($res)>0) {
while ($row = mysql_fetch_row ($res)) {
$Codnot=$row[0];
$Titulo=$row[1];
$Activo=$row[2];
$Tipo=$row[3];
$Fecha=$row[4];
$Fecha_fin=$row[5];
$Descripcion=$row[6];
$Home=$row[7];
$Autor=$row[8];
$Cod_categoria=$row[9];
$Orden=$row[10];
$Subtitulo=$row[11];
$Mostrar_fecha=$row[12];
$Precio=$row[13];
$Destacada=$row[14];
//----------------------------------------
$Fecha=fechaformat($Fecha);
$Descripcion=CortaString($Descripcion,100);
?>
}
}
?>
Solicita presupuesto sin compromiso