Custom layout is throwing an error on encoded json

edited November 2015 in Bug Reports
Hey,

I'm using encoded json on data-attributes of certain elements and only on my custom layouts is this error being thrown:

An Error Was Encountered Compilation error at line 236 in "string:" : Parse error in ""name":"Event 1","url":" [..]

The HTML that is throwing the error looks like this:

<p><a data-popover="{&quot;name&quot;:&quot;Event 1&quot;,&quot;url&quot;:&quot;evenementen\/event-1&quot;,&quot;image&quot;:&quot;assets\/image.jpg [..] ">Event 1</a></p>

(my edit of [..] for brevity on the above two quotes)

In other pages, one's that I've made through PHP in fuel/application/views, are not throwing this error, it's only custom pages made through Dashboard > Pages. The code used to display this element is exact the same on all pages, and it's:

<?php $this->load->view('_blocks/sidebar', $this->sidebar_model->get_sidebar()); ?>

That's in my views/_layouts/x.php and the views/x.php page.

Any idea? The error seems so strange that I thought perhaps it's the template engine throwing an error?

Thanks,

Comments

  • edited 9:00AM
    That is the template engine... it's because the delimiter for the template engine is the "{}" by default (this can be changed). If a space is added after the { then it the parsing engine will ignore that (str_replace('{', '{ ', $str)).

    Also, you can wrap things in {literal}.....{/literal} to escape template parsing.
Sign In or Register to comment.