Welcome Guest, Not a member yet? Register   Sign In
Need help with counting articles on comments and categories on homepage
#9

[eluser]DumpProgrammer[/eluser]
Whenever I have been trying to put the getcomments($postid) in controller I get an error because I have not yet declared the $postid variable. Here is how I have added the getcomments in the view look for the getcomments, $category and $totalcomments
Code:
<?php
if (count($post)){    
    $z= 1;
    foreach ($post as $id => $posted){
      
       if($z%2) {
   $i = "fl";  
        }
    else{
        $i = "fr";        
    }
       $image_properties = array(
          'src' => 'uploads/'.$posted['image'],
          'alt' => $posted['title'],
          'class' => 'thumbnail',
          'width' => '100',
          'height' => '57',
          'title' => $posted['title']);
              
              echo "<div class='post $i'>";                      
           echo "<div class='box-post-content'>";
           echo anchor('blog/post/'.$posted['id'],img($image_properties));
           echo anchor('blog/post/'.$posted['id'],"<h2>".$posted['title']."</h2>");
           echo "<p><em>".$posted['pubdate']."</em></p>";

            echo "<p>".word_limiter($posted['body'],30)."</p></div>";
            
            echo "<p><span class='continue'>";
            echo anchor('blog/post/'.$posted['id'],'Read full story')."</span></p>";
            
        $category = $this->MCats->getCategory($posted['id']);
        
        echo "<p class='posted'>Posted in ".anchor("blog/category/".$posted['id'],$category['name']);
        $countcomments = $this->MComments->getComments($posted['id']);
        $totalcomments = count($countcomments);
        echo "<span class='comments'>".anchor('blog/post/'.$posted['id'],$totalcomments.' Comments');
        echo "</span></p></div>&lt;!--/post--&gt;";        
      
        $z++;
        
        if($z%2) {
            
        echo "<div class='hl-full'></div> <div style='clear:both;'></div>";
        }
    }        
}

?&gt;


Messages In This Thread
Need help with counting articles on comments and categories on homepage - by El Forum - 02-16-2010, 06:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB