Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
View from HTML not from file?
  • Hello, It's possible to only pass HTML data to view rather than forge from a file?

    View::forge('html_content', []);

    Thanks advance.
  • Hello ham !
    To achieve this you can create a basic view and pass content in the second param.
    You want to pass html code string in quote ?
  • Harro VertonHarro Verton
    Accepted Answer
    We use an extended View class in your apps so we can use a string as a template. It writes it to a temp file in the app tmp directory, and then sets that file as view template. We do this for caching and performance reasons.

    Alternatively you can pass your HTML as data like @Stagram suggested, and echo the variable in your view. Make sure you don't disable encoding on your data, to avoid serious security issues.

Howdy, Stranger!

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

In this Discussion