I've looked into everything. I don't why I'm getting a Parse error: syntax error, unexpected 'if' (T_IF) at this part
if(is_array($comment_contents) || is_object($comment_contents)){
This is my whole code
<?php
if(is_array($home_contents) || is_object($home_contents)){
foreach($home_contents as $object_home){
echo'<div class="col-sm-offset-2">
<blockquote>
<p>' . $object_home->post_content .'</p>
<small>' . $object_home->poster_name . ' posted in <cite title="Source Title">'. $object_home->group_name .'<br/><br/></cite></small>
<form method="POST" action="<'. base_url('Home/getComment') .'>">
<input type="text" class="form-control hidden" name="postid" id="search" value="'. $object_home->post_id .'">
<button type="button" class="btn btn-default" data-toggle="collapse" aria-pressed="false" autocomplete="off" data-target="#demo"><span class="glyphicon glyphicon-comment"></span> Comment</button>
</form>
<div id="demo" class="collapse out">
<div class="form-group">
<label for="comment"></label>'.
if(is_array($comment_contents) || is_object($comment_contents)){
foreach ($comment_contents as $object_comment){
.'<h6>'. $object_comment->comment_content .' by '. $object_comment->full_name .' at '. $object_comment->post_date .'</h6>'.
}
}.'
<textarea class="form-control" rows="5" id="comment" placeholder="Enter Comment..."></textarea>
<p></p>
<div class="pull-right">
<button type="button" class="btn btn-default"><span class="glyphicon glyphicon-comment" aria-hidden="true"></span></button>
</div>
</div>
</div>
</blockquote>
</div>';
}
}
?>
any help would be much appreciated.