Ejemplo de uso sencillo.
Código PHP:
$mp = &new NoticiaMapper();
$noticias = $mp->obtListaNoticias();
foreach($noticias as $noticia ){
echo $noticia->obtId()."<br>\n";
echo $noticia->obtTitulo()."<br>\n";
echo $noticia->obtDescripcion()."<br>\n";
echo $noticia->obtFecha()."<br>\n";
echo $noticia->obtImagen()."<br>\n";
echo $noticia->obtLiga()."<br>\n";
}
Uso sencillo agregar noticia:
Código PHP:
$datos = array( 'id_noticia'=>'',
'id_usuario'=>'1',
'titulo'=>'xxx',
'descripcion'=>'yyyy',
'fecha'=>'2003-02-01',
'imagen'=>'algo.jpg',
'link'=>'http://www.algo.com'
);
$noticia =& new Noticias($datos);
$mp = &new NoticiaMapper();
if($mp->agregar($noticia)){
exit('La notcia se agrego');
}