私のオーサーコントローラーファイル
class AuthorController extends AppController {
public function author_quotes_list($author,$page="null")
{
$perpage=30;
$this->commen();
$author_data=$this->Author->query("select author.*,professions.professions_name from author,professions where author.professions_id=professions.id and author.author_name='$author' and author.status=1 ");
$this->set('author_data',$author_data);
//paging
$count=$quotes_data=$this->Author->query("select count(id) from quotes where author_id=".$author_data[0]['author']['id']." and status=1");
$limit=$this->paging($page,$count,$perpage);
$quotes_data=$this->Author->query("select id,quotes from quotes where author_id=".$author_data[0]['author']['id']." and status=1 limit $limit,$perpage");
//print_r($quotes_data);
$this->set('quotes_data',$quotes_data);
}
public function ratings($q_id)
{
//echo $quotes_id;
$tuser=$this->Author->query("select count(id) from user where status=1");
//print_r($tuser);
if($tuser==NULL)
{
$this->set('tuser',0);
}
else
{
$this->set('tuser',$tuser[0][0]['count(id)']);
}
$vusers=$this->Author->query("select * from totalrate where quoteid=$q_id");
print_r($vusers);
if($vusers==NULL)
{
$this->set('vuser',0);
$this->set('trate',0);
}
else
{
$this->set('vuser',$vusers[0]['totalrate']['totaluser']);
$this->set('trate',$vusers[0]['totalrate']['totalrate']);
}
}
私の author_quotes_list.ctp ファイル
<?php $this->requestAction(array('controller' => 'Author', 'action' => 'ratings/'.$quotes['quotes']['id']));?>
<div class="star_txt">(<?php echo $trate; ?>/5, <?php echo $vuser; ?> votes) from <?php echo $tuser; ?> Users</div>
オーサーコントローラーの評価関数を呼び出すと、この関数が呼び出されますが、$trate、$vuser、および $tuser の値は設定されません。