Issue
I got a row from database table now I wish to echo only one value from this row in CakePHP. So how to do it?
$help = $this->help->findByControllerAndAction($controller ,$action)
it has four values: id, controller, action and help_text.
I want to echo only controller.
Any help?
Solution
I suggest reading some of the documentation, more specifically this section.
To answer your question...
I assume your Help model has a unique key controller+action.
In your controller's method you will need:
$help = $this->Help->findByControllerAndAction($controller ,$action);
if ($help) {
$this->set('help', $help);
}
In your view:
echo $help['Help']['controller'];
will show the content of the Help.controller field.
Use:
debug($help);
If $help is not defined in your view, chances are your find is not returning the results you expect.
Answered By - savedario Answer Checked By - Gilberto Lyons (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.