Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Having issues with encoded entities.
  • I'm trying to pass database-contained HTML (from a page editor, via a WYSIWYG). I'm passing said HTML into a view. But rather than returning <p>, it returns the html-decoded version, so when it is displayed, I don't see a string wrapped within a paragraph, but rather a string containing the lt and gt's Is there a way to disable this for that particular loading of the view?
  • Fuel by default encodes on output. If you're data is already encoded, assign the data to the view without encoding it by passing false as third parameter of the set() method.
  • You can also use View::$auto_encode=false;
  • Correct. But that will disable all encoding, which from a security perspective isn't the preferred option.
  • So how would I go about doing it like such? $this->template->content = $page->content; Where $page->content is the result from the table, containing the html characters and content.
  • Here's an example of how I've done it: $view = View::factory('admin/view_examples_all');
    $view->set('examples', Model_Mexamples::get_example_info(), false);
    $this->template->content = $view;
  • I understand that, but the problem is $page->content isn't coming from a view, but rather coming from the database.
  • $this->template should be a view. So $this->template->set('var', $var, false); should do the trick...
  • Works like a charm, thank you sir.

Howdy, Stranger!

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

In this Discussion