I have a PHP issue that I can't seem to resolve. If anyone can help it would be...

JDL12345

New member
...greatly appreciated. Thanks.? I've got an issue with a page that is listing news stories from a mysql db. The problem is that it only lists stories if there are 2 or more in the db. It does not list anything if there is only 1 story in the db. I've looked through the code and the code it calls upon and I can't see what is wrong. The 'include('init.php');' call is to an _autoload function. The rest is in classes. The classes seem fine and return the record set ok it seems. Please help!

<?php
include('init.php');
$news = RequestRegistry::getNewsMapper()->findAllForFront();
?>

<style>
a:link, a:visited, a:active {
color: #CCCCCC;
text-decoration:none;
}
a:hover {text-decoration:underline;}
</style>
<link href="css/iframe.css" rel="stylesheet" type="text/css" />

<div class='newsbox'>
<?php foreach ($news as $story){ ?>

<h2><?= $story->getTitle(); ?></h2>
<div class='story'>
<div class='text'>
<p><strong><?= date('jS M Y', $story->getDisplayDate()) ?></strong></p>
<?= $story->getShortText(); ?>
<br />
<a class='morelink' target='_parent' href='news-single.php?id=<?= $story->getId() ?>'>Read More...</a>
</div>
<div class='image'>
<?php if ($story->getFeaturedImageId() != 0): ?>
<a target='_parent' href='news-single.php?id=<?= $story->getId() ?>'><img src='images/news/<?= $story->getFeaturedImageId() ?>.jpg' width='120' height='90' style="border:#666666 medium solid;" /></a>
<?php endif ?>
</div>

</div>
<div class='clear-both'></div>

<?php } ?>

</div>
 
Back
Top