Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Class Static Method Issue
  • I've created a simple Messages class in the app/classes directory and created a public static function display() that will output the html to create the correct alert message based on some arguments. Here is the problem. I have a Controller that is extending Controller_Template. Just to test things out I used: $data = Messages::display();
    $this->template->content = View::factory('user/login', $data); I echoed $message in the view only to have the quotes, less than, and greater than converted to their entity representations. Ex: & quot; (without the space between them) I moved the Messages::display directly into the view and echoed it directly and it works perfectly. Is there something I'm missing passing this through to the view via the controller?
  • Hello, what Fuel does - it auto encodes data by default (it's a setting in the config.php) 'auto_encode_view_data' => true.
    in that case, if you pass to view, not only strings, but also full html, you should pass false (it sets to encoding > false) as third paramater to the view, like: $this->template->content = View::factory('user/login', $data, false);
    more info here: http://fuelphp.com/dev-docs/classes/view.html
    and here; http://fuelphp.com/dev-docs/general/configuration.html - as you can see you can play with: security.whitelisted_classes - maybe it'll help you too :) but remember then escape everything yoiu need in messages class, so you don't have problems later! good luck
  • Thanks huglester! I figured it was something simple. :)

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion