Ver Mensaje Individual
  #2 (permalink)  
Antiguo 16/07/2005, 06:39
Spyn_ET
 
Fecha de Ingreso: diciembre-2003
Mensajes: 218
Antigüedad: 20 años, 4 meses
Puntos: 0
A ver q tal esta idea ¿?

Código PHP:

class Noticia
{

var 
$titulo;
var 
$texto;
var 
$fecha;
var 
$autor;

function 
Noticia ($titulo$texto$autor,$fecha)
{
$this->titulo $titulo;
$this->texto $texto;
$this->autor $autor;
$this->fecha $fecha;
}

function 
Muestra()
{
$content  "<table width=\"100%\">";
$content .= "<tr><th>$this->titulo</th><th>$this->fecha)</th></tr>";
$content .= "<tr><td>$this->texto</td><td>;nbsp</td></tr>";
$content .= "<tr><td>;nbsp</td><td>$this->autor</td></tr>";
$content .="</table>";
return 
$content;
}

index.php

Código PHP:
...conexionquery y demas,.....

include (
'class-noticias.php');

$news = new Noticia($row["titulo"],$row["texto"],$row["autor"],$row["fecha"]);
$news->Muestra(); 
Visto lo visto, con mi ejemplo no parece muy necesario usar una clase. Pero espero q te sirva :D

Un saludo.
__________________
SymbianForever
SymbianForever.com, todo sobre y para tu symbian
aNieto2K | Themes para WordPress
De todo un poco