Can't print values in "view". But I can print them ok in "controller" and "model"! |
[eluser]behnampmdg3[/eluser]
Hello; I am sure this is a simple thing. I was wondering why I get this error. Many thanks. Quote:A PHP Error was encounteredController Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Model Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); View Code: <?php print_r($p);?> Please note" Print_r($p) shows correct results in controller and model, but not in view!
[eluser]jmadsen[/eluser]
if you look in the system file: system/core/loader at: Code: public function view($view, $vars = array(), $return = FALSE) you'll see that the parameter that passes the data must be an array or object. The most typical way to pass your data would be: Code: $data['p'] = $this->logic_model->show_hotels(); In your view you can then access $p as a variable
[eluser]LuckyFella73[/eluser]
Code: // in your controller Look at the manual to get detailed information about that: http://ellislab.com/codeigniter/user-gui...views.html Section "Adding Dynamic Data to the View" |
Welcome Guest, Not a member yet? Register Sign In |