Error: Parse error: syntax error, unexpected end of file ayuda

<?php
@header( 'Content-Type: text/html; charset=iso-8859-1' );
require_once 'database/mysql.php';
$db = new Mysql;
?>
<!DOCTYPE html>
 <html>
 <head>
 <title>News</title> 
 <link href="css/home.css" rel="stylesheet">
 <link href="css/bootstrap-combined.min.css" rel="stylesheet">
 <script src="js/bootstrap.min.js"></script>
 </head>
<body>
 <div id="news" class="span12">
 <?php 
 //$db->url = 'noticias.php'; 
 $db->paginate(4);
 $db->query("select * from noticia order by noticia_id desc")->fetchAll(); 
 if ($db->rows >= 1):
 $news = $db->data;
 foreach ($news as $new):
 $n = (object) $new;
 $n->noticia_content_cut = $db->cut($n->noticia_content, 300, '...');
 if ($n->noticia_foto == "" || strlen($n->noticia_foto) <= 1):
 $n->noticia_foto = "images/nopic.png";
 else :
 $n->noticia_foto = "thumb.php?img=fotos/$n->noticia_foto";
 endif;
 ?>
 <div class="media">
 <a class="pull-left" href="noticia.php?id=<?= $n->noticia_id ?>">
 <img src="<?= $n->noticia_foto ?>" class="media-object img-polaroid" />
 </a>
 <div class="media-body">
 <h4 class="media-heading"><?=$n->noticia_title ?></h4>
 <p><small><?=$n->noticia_content_cut ?> <em><a href="noticia.php?id=<?= $n->noticia_id ?>" class="btn btn-link">leia mais</a></em></small>
 </div>
 </div>
 <hr />
 <?
 Endforeach;
 echo $db->link; 
 endif;
 ?>
 </div>
 </body>
</html>

2 Respuestas

Respuesta
1

Me funciona ese era el problema :D

Respuesta
1

Como único error veo que te falta una apertura de php

¿

¿
<?
 endforeach;
 echo $db->link; 
 endif;
 ?>

Siendo asi:

<?php
 endforeach;
 echo $db->link; 
 endif;
 ?>

Aun asi, siempre me ha gustado mas usar las formas "antiguas", tipo:

if (){
} else {
}

que las nuevas, que ademas de controlar menos, puede que tengas ahí un error, revisa tambien esa parte por si acaso.

Dime con lo que sea y de mientras repaso esas formas.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas