Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/02/2013, 12:24
Avatar de CMushroom
CMushroom
 
Fecha de Ingreso: diciembre-2011
Ubicación: Morelos
Mensajes: 99
Antigüedad: 14 años, 9 meses
Puntos: 1
Pregunta construir link dinamico o como se llama esto?¿

en un menu lateral se muestra estas categorias y cuando le das clic a una se cargan su articulos respectivos de las categorias en el div central a ecepcion cuando le das a categoria todos carga todos los articulos de todas categorias, el problema es que no se como hacer para que al dar clic en la noticia se despliegue solo el titulo de la noticia con su articulo lo poco que e avanzado me hace feo pues aparecen con un tamaño bastante grande al pinchar y solo aparece el contenido del articulo y no asi su titulo del el articulo, como le puedo hacer?¿ POR FAS

categoria.php

Código PHP:
<h1>Categorias</h1>
<?php
$consulta 
= mysql_query("SELECT * FROM sn_categorias", $db_link)or die(mysql_error);

echo 
"<ul>";
echo 
"<li><a href='index.php'>Todas</a>";
while(
$row = mysql_fetch_array($consulta))
    {
    echo 
"<li><a href='?categoria=$row[catCategoria]&amp;id=$row[cat_ID]'>$row[catCategoria]</a></li>";
    }
echo 
"</ul>";
?>
noticia.php

Código PHP:
<?php 
if(isset($_GET['id']) && $_GET['categoria'])
    {
    
$categoria_ID = $_GET['id'];
    
$categoria = $_GET['categoria'];
    
$clausula = "WHERE notCategoriaID = '$categoria_ID'";
    
    
$titulo = "Noticias en la categoria $categoria";
    }
else
    {
    
$titulo = "Todas las noticias";
    }
@
$consulta = mysql_query("SELECT * FROM sn_noticias $clausula", $db_link)or die(mysql_error);//lA CONSULTA SE ARMA SEGUN CRITERIO MENU

echo "<h2>$titulo</h2>";
while(
$filaNoticia = mysql_fetch_array($consulta))
    {
    echo 
"<a href='?categoria=$filaNoticia[notTitulo]&amp;categoria=$filaNoticia[notTexto]&amp;id=$filaNoticia[notTitulo]'><h3>$filaNoticia[notTitulo]</h3></a>";// SE PONEN LOS LINKS CON RESEÑA QUE TE REDIGIRIRAN
    
    
echo nl2br("$filaNoticia[notTexto]"); 
    }
    
?>
Código PHP:
--
-- 
Base de datos: `sistemanoticias`
--

-- --------------------------------------------------------

--
-- 
Estructura de tabla para la tabla `sn_categorias`
--

CREATE TABLE IF NOT EXISTS `sn_categorias` (
  `
cat_ID` int(11) NOT NULL AUTO_INCREMENT,
  `
catCategoria` varchar(100) NOT NULL,
  
PRIMARY KEY (`cat_ID`)
) 
ENGINE=MyISAM  DEFAULT CHARSET=latin1 ;


--
-- 
Estructura de tabla para la tabla `sn_noticias`
--

CREATE TABLE IF NOT EXISTS `sn_noticias` (
  `
not_ID` int(11) NOT NULL AUTO_INCREMENT,
  `
notTitulo` varchar(255) NOT NULL,
  `
notTexto` text NOT NULL,
  `
notCategoriaID` int(11) NOT NULL,
  
PRIMARY KEY (`not_ID`)
) 
ENGINE=MyISAM  DEFAULT CHARSET=latin1 ; 
ASI VA EL INDEX.PHP

Código PHP:
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />    
    <title>Sistema de Noticias - por C-Mushroom Plus</title>
    <link rel="stylesheet" href="estilo.css" type="text/css" media="screen" />
</head>

<?php include('conexion.php'); ?>
<?php 
include('header.php'); ?>
<div style = "float:left; width: 23%;">
    <?php include('categoria.php'); ?>
    <?php include('admin.php'); ?>
</div>
<div style = "float:left; width: 54%;">
    <?php include('noticia.php'); ?>
</div>
<div style = "float:right; width: 23%;">
    <?php include('list-imagenes.php'); ?>
    <center>
        <br><br>
        <img src="imagenes/cosplay-jade-mileena-mortal-kombat.jpg" width="194" height="271">
        <br><br>
          <img src="imagenes/Hannah Minx .jpg" width="194" height="290"></center>

</div>
</body>
</html>