Ver Mensaje Individual
  #3 (permalink)  
Antiguo 26/01/2010, 09:21
sloganernesto
 
Fecha de Ingreso: noviembre-2009
Mensajes: 9
Antigüedad: 14 años, 5 meses
Puntos: 0
Respuesta: Variable PHP en keywords

este es el codigo php con la consulta para obtener las keywords

$query="SELECT * FROM noticias WHERE id='".$_GET['id']."' AND activo='1' LIMIT 1";
$resul=mysql_query($query, $conex);
if($resul==false)
{
echo mysql_errno().': '.mysql_error();
exit();
}
while($fila=mysql_fetch_array($resul))
{
$tags=str_replace(" ",", ",$fila['tags']);
$titulonoticia=$fila['titulo'];
}
mysql_free_result($resul);


y esta la cabecera de la web donde las muestra

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Nombre</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<meta name="keywords" content="<?php
if($tags=="" || !isset($tags))
{
echo "palabras, clave, estandar";
}
else
{
echo $tags;
}
?>" />
<meta name="description" content="<?php
if($titulonoticia=="" || !isset($titulonoticia))
{
echo "Descripción genérica para todas las páginas";
}
else
{
echo $titulonoticia;
}
?>" />