Issues with Smarty and curly braces delimiters

Hello All,

I am trying to create a new Field Type at my suitecrm instance.
The new Field is a map viewer .

The new field will have custom view for the three actions (“DetailView” , “EditView” and “ListView”)
where both DetailView and EditView will view the map inside the form next to the field label
but at the ListView will show the map right after the table list.

So at Class of the new i created that extended the “SugarFieldBase” ,
i called the getEditViewSmarty and getDetailViewSmarty methods like this

 function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {        
        $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex, true);
         $mapManager->display($this->ss);
//Some Other lines
}

Please notice the last parameter of calling the setup method is set to true. which is the $twopass flag to make sure that the delimiter is set to “{{” and “}}”

The Map Manager Display method fetch some tpls files i created using the smarty template.

Regards the ListView part, i added a logichook “after_ui_frame” to to call the same method after the ListView which calls the same Display method of the map manager.

like this


//Some Other Lines
$ss = new Sugar_Smarty();
$ss->left_delimiter = '{{';
$ss->right_delimiter = '}}';
$mapManager->display($ss);

So the smarty template (when called from ListView) doesn’t parse the assigned vars and it genearte parsing errors because of the delimiters “{{” and “}}” and it seems it expects to accept single braces “{” as its delimiter even if i changed the delimiter to double braces.

the smarty template can’t even recognize the {literal} and {/literal} which i can see them at the dom using google inspect element tool.
-The expected behaviour that they won’t show up if the tpls were parsed correctly -

Can any one please let me know what i am doing wrong ?

Thank You,

I am adding an example for the tpl file since i forgot to add it to the main thread.

<link rel="stylesheet" href="Link/to/some/css/files">


<script>
    {literal}
    var jsonArray = {
    group: {
        key:value,
    }
    };
    {/literal}
</script>
<script src="Link/to/some/js/file"></script>

<script type="text/javascript">
  
        var template1 = {{ $template1_json}};
        var template2 = {{ $template2_json}};
        var template3 = {{ $template3_json}};
  
</script>

<div id="{{$template1.mapId}}" class="map" style="height: {{$template1.height}}px"></div>

the {literal} tag seems to be ignored by smarty when using the ListView , which is not behaviour at the Detail,EditView since the smarty recognise the {literal} tags

A new update to my issues,

it seems to me that the delimiter of smarty keep to be changing between double braces and single braces based on unknown behaviours.

i am writing my tpl template assuming that the delimiter is single braces { } , and after couples of hours and many page reloading and refreshed , the delimiter changed to be {{ }} which broke my code.

Is there a way that i can fix the delimiter to be only double braces to make sure my tpls won’t break for unknown reasons ?

Thank you