Hi all,
I am using cakePHP 1.26.
The web page turned out blank when I tried to use requestAction to access a function in a COntroller from a .ctp.
Here is the code:
<?php
class TestingController extends AppController {
function hello($id=null){
$IfLoggedIn=$this->Session->check('user');
if($IfLoggedIn){
//search the database
//$result=doing something from the search results
$this->set('userInfo',$result);
return "2";
}
else if(!$IfLoggedIn && $id!=null){
return "1";
}
else if($id==null){
return "0";
}
}
}
and then in default.ctp file, I made use of the function defined above:
<?php
$u = $this->requestAction('/hello');
if($u=="2"){
echo "welcome back, my friend";
}
else{
echo "Hello World";
}
?>
But when I load a web page, it was blank page.
I have no idea what's wrong in the code.