I have a strange problem after importing modules which were created by the module builder. For one of my modules, there appear to be unresolvable variables in the smarty templates generated by suiteCRM:
[XXXX] [:error] [pid XXXX] [client XXX] PHP Fatal error: Smarty error: [in cache/themes/Suite7/modules/sifa/SearchForm_basic.tpl line 155]: syntax error: unrecognized tag: $fields…name (Smarty_Compiler.class.php, line 446) in /var/www/html/suitecrm/include/Smarty/Smarty.class.php on line 1094, referer: XXX
The smarty template contains lines like this:
I know which variable is causing the problem, but unfortunately I do not know why this variable is not present. I assumed that the module builder creates them automatically. I tried to repair my suiteCRM instance and deleted all caches, but the problem is still there.
Do you have a suggestion or at least a hint how I could debug this issue. I found some posts reporting similar problems (https://community.sugarcrm.com/thread/20535). However, if possible i would like to avoid tampering with the fields_meta_data table, because I would like to have portable, self-contained modules.
Thanks you very much for your help and kind regards,
Julian
@julianthome I remember seeing this issue a while back. I wonder what version of SuiteCRM you are running, is it an old version?
And what version of PHP and MySQL do you have?
A small advice just to make sure: when you try a Quick Repair and Rebuild, scroll down to the bottom to see if there are mismatched vardefs, and a button to fix that. If so, press the button.
Try also a few other repairs that look relevant on the Admin / Repair menu.
Please check also if you have a file in you have a file in custom/Extension/modules/sifa/Ext/Vardefs.php that partially defines a field that is missing from fields_meta_data table in database.
I hit the same problem with custom module. From all custom modules only 1 has this problem,
in:
in cache/themes/SuiteP/modules/MODULE_NAME/SearchForm_advanced.tpl
there are times where I have 2 dots.
I can not find where this originates. Any ideas?
Suite version: 7.10.27
In that part where it calls the Smarty sugar_field custom function, defined here:
–> Smarty/plugins/function.sugar_field.php
The bug is likely either the way the parameters are passed into that, or something inside the function. You get a double dot .. because there’s an empty string between those two dots, some variable it couldn’t reference.
I got your solution, but How do you fix it, can you have any code or screenshot, of how to resolve them? Because It is very tough to find Where this “…” is coming from. Please send the resolution for that.
This is Error
Fatal error: Smarty error: [in cache/themes/SuiteP/modules/Tasks/EditView.tpl line 63]: syntax error: unrecognized tag 'main' (Smarty_Compiler.class.php, line 584) in C:\wamp64\www\simplecrm_v268\vendor\smarty\smarty\libs\Smarty.class.php on line 1099
If you delete your cached tpl file, it should get recreated automatically. Try that, to see if the same error appears again.
Other than that, my answer above suggests a couple of places to look, you can hook up a debugger and look into that. But if you don’t know how to do that, it’s not something I can briefly instruct you here…
Actually, we have done everything, Like clearing cache and debugging data and all, We just upgraded PHP8.2 from PHP 8, and our Smarty version is 2. Now problem is When we set up the instance on Local and on the error reporting at that time this error comes in Listview and EditView layout both, I think if we have a solution to that, then overall all the problems will be sorted. We don’t change the Smarty Version so please don’t suggest that.
Sometimes when I get in trouble with Smarty I try to debug the actual compiled templates.
So
To clear the mess, delete the entire contents of cache\smarty\templates_c
Visit the edit view you want, a new file should be generated there with a weird name like %%62^62E^62E293EC%%EditView.tpl.php
That file is full of ugly PHP code, but you can set breakpoints on it, so you can examine how it is getting generated. You can also use the IDE to climb up the stack and examine the functions providing the data into the template (with assign commands), that is often what needs to be fixed.