Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Passing HTML in mustache
  • I'am new to templating engine like mustache + integration with fuelphp. I'am trying to pass Asset::css(array('some_css')); to templating and i'am getting trouble with rendering. The output always show htmlentities version of the output. so when it means 

        <link href= 

    it will become

       &lt; link

    How do i get this done to make it render css properly? am i miss some concept?
  • ilNotturnoilNotturno
    Accepted Answer
    Check your code I think the somehow in your code you do something like that:

    $view = View::forge('path/to/view', $configuration));

    You have to add "false" (or true, I don't remember :-] ) in the third field. Read this for explanation: http://fuelphp.com/docs/classes/view.html

    So your view will became:

    $view = View::forge('path/to/view', $configuration, false));

    or

    $view
    = View::forge('path/to/view', $configuration, true));
  • Ups, i'am click the accept button. can i revert it? for sure.

    So, it is not recomended to use the way like...

    $view = View::forge('index.mustache'); 
    $view->name = 'Arif Setyawan';
    $view->set_safe('css',Asset::css(array('bootstrap.min.css','bootstrap-responsive.min.css')));
    return $view;

    ?
  • Nothing wrong with this approach.
  • With this approach it depends on default encoding setting, that you can set in your config.
    If you want to manage your data I'll suggest you to use the "set" method:

    $view
    ->set('name''Arif Setyawan', false);

    or

    $view
    ->set('name''Arif Setyawan', true);

  • set_safe() is an alias for set('var', $var, false).
  • Sorry, I didn't noticed that it used that for the second one. My brain read only the "set" value while reading its code.

Howdy, Stranger!

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

In this Discussion