This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Exzo
Exzo

I have variable in my code, and this variable display html tags like this:

html tags

My code:

function onStart()
{
        $ch = curl_init (); // init
        curl_setopt ($ch , CURLOPT_URL , "https://test/");
        curl_setopt ($ch , CURLOPT_USERAGENT , "Mozilla/5.0"); // browser
        curl_setopt ($ch , CURLOPT_RETURNTRANSFER , 1 ); // content to variable
        $content = curl_exec($ch); // downloading page
        curl_close($ch); // close connection

        $this->page["recentPosts"] = $content;

}

my html:

<div class="container">
    <div class="row">
        <div class="col-lg-12">
            {{ this.page.recentPosts }}
        </div>
    </div>
</div>

Last updated

Exzo
Exzo

{{ this.page.myVar|raw }}

axomat
axomat

I think you need to read the manual

If the onStart is a php function defined in a page (rather than a plugin) then you can define a variable like this

    $this['recentPosts'] = $content;

Then display it with

{{ recentPosts }}

Hope this helps

alex11628
alex11628

Assuming everything else is correct,

{{ recentPosts|raw }}

should work for you.

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.