Эх сурвалжийг харах

Makes sure that there is posts before trying to display them (regression)

Michael Francis 14 жил өмнө
parent
commit
e5f8235130

+ 7 - 2
views/Users/feed.html.php

@@ -18,7 +18,9 @@
    <?= $this->form->submit('Post!', array('class' => 'button', 'style' => 'float:right')); ?>
 <?= $this->form->end(); ?>
 <br class ="cl">
-		<?php foreach($feed as $post) { ?>
+
+		<?php if(isset($feed)): ?>
+		<?php foreach($feed as $post): ?>
 		<div class="grid_4"><img class="inlinepic" src="/img/about.jpg" alt="" /></div>
 		<div class="grid_8">
 			<h4><?= $post->username ?></h4>
@@ -38,7 +40,10 @@
 			</ul>
 		</div>
 		<br class="cl">
-	<?php } ?>
+		<?php endforeach;  ?>
+	<?php else: ?>
+		<p>Woops! There's no posts yet. Make some friends and get the party started!</p> 
+	<?php endif; ?>
 	</div>
  <br class="cl" />
  <br class="cl" />