Smarty Double curly braces

Hello.

Can someone explain for what and ho to use double curly braces.(’{{’,’}}’)

If i use solo ones(’{’,’}’) it normally goes. But if i use two of them CRM show me an error.

Can someone help ?

It depends on which view you are editing. The reason is that on some views, the template is processed twice. For example: the detail and edit views are processed twice, as well as the SearchForm. So they require double {{…}}

However the list view, dashboard, dashlets, popups, subpanels and other areas are processed once. So they require the single {…}

Okey. I figured out what to do. If u want to use double curly braces then u need to create TemplateHandler variable and use functions from this class.

Could you please explain, how to do it?

I see this β€œdouble curly brace” requirement in templates (for Detail, Edit, and SearchForm views) is a huge bug!

The reason is that on some views, the template is processed twice. For example: the detail and edit views are processed twice, as well as the SearchForm. So they require double {{…}}

When Suite will process a template 2+ times, it should NOT break when there is only 1 curly brace. It should work OK with the 1 copy (or 2 copies, for backward compatibility) of the curly brace! C’mon, people! Let’s make this app be fully unbreakable!

Hi Chris,

Actually it’s not a bug. If you take a look to the Smarty configuration in some of the view controllers you will see it’s specificaly set to use double curly braces. You can see this for example in include/TemplateHandler/TemplateHandler.php in the buildTemplate method.

From my understanding the fact that a tpl is processed twice is for caching porpuses. The first time a views tpl is processed it’s for generating the static parts of the page (For example the view structure defined in the modules metadata). Then the file generated is another tpl that will be stored in the cache folder to avoid processing the same file multiple times.

Then that second generated tpl will contain all the dynamic contents (For example the render of the values of a registry. Those values should change depending on what registry you are looking at). This second process is done always.

Also is worth noticing that the first process will be done always if you have developer mode active.

If I said something that is incorrect feel free to correct me.

Exactly, we need to make SuiteCRM unbreakable :broken_heart: and user-friendly particularly for non-tech background people who wants to use it :desktop_computer: :computer_mouse:

So, you mean it is all correct code in v7.14.3 and it will call once in production mode?