Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Unusual behavior with $view->set('item',$myitem,false);
  • Hi all, Just experienced a rather strange output to my code, wondered if anybody else had experienced it? It's probably something I'm doing but I'm not sure....
    $staff = Model_Staff::find()->where(\DB::expr('REPLACE(LOWER(CONCAT(title,"-",job_title))," ","-")'),$title)->get_one();
    if( !$staff )
     \Request::show_404();
      
    $view =  \View::factory('staff/view');
    $view->staff = $staff;
    $view->set('staffarticle','<p>hello joe</p>',false);
    

    In my view I output $staffarticle and this behaves correctly. However, if I swap
    <p>hello joe</p>
    
    for
    $staff->article
    
    it escapes the data from the DB which I've told it not to do. Any ideas?
    Rob :)
  • Solved this. Apparently the line
    $view->staff = $staff;
    
    escapes the data in the object and then transfers the object to the view rather than transferring byval to the view and then escaping. Switch the last two lines around and it works
  • The way data is escaped (filtered) has been modified in 1.1/develop. It now uses 'lazy escaping', that is the escaping only happens when the data is sent to the view, and no longer when you set it.

Howdy, Stranger!

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

In this Discussion