Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "modules\grid.tpl" on line 62 "columns: [{ field: "FirstName" }, { field: "LastName" }, {command: "destroy"}]," - Unexpected ": ", expected one of: "}" , " "' in C:\xampp\php\Smarty\sysplugins\smarty_internal_templatecompilerbase.php:627 Stack trace: #0 C:\xampp\php\Smarty\sysplugins\smarty_internal_templateparser.php(3154): Smarty_Internal_TemplateCompilerBase->trigger_template_error() #1 C:\xampp\php\Smarty\sysplugins\smarty_internal_templateparser.php(3219): Smarty_Internal_Templateparser->yy_syntax_error(2, ': ') #2 C:\xampp\php\Smarty\sysplugins\smarty_internal_smartytemplatecompiler.php(105): Smarty_Internal_Templateparser->doParse(2, ': ') #3 C:\xampp\php\Smarty\sysplugins\smarty_internal_templatecompilerbase.php(171): Smarty_Internal_SmartyTemplateCompiler->doCompile('<!doCTYpe html>...') #4 C:\xampp\php\Smarty\sysplugins\smarty_internal_template.php(187): Smarty_Internal_TemplateCompile inC:\xampp\php\Smarty\sysplugins\smarty_internal_templatecompilerbase.php on line 627
$(function() {
$("#grid").kendoGrid({
dataSource: {
transport: {
read: "data/employees.php",
update:
{
url: "data/employees.php",
type: "POST"
},
destroy:
{
url: "data/employeeDelete.php",
type: "DELETE"
},
create:
{
url: "data/employees.php",
type: "PUT"
}
},
error: function(e) {
alert(e.responseText);
},
schema: {
data: "data",
model: {
id: "EmployeeID",
fields: {
FirstName: { validation: { required: true} },
LastName: { validation: { required: true} }
}
}
}
},
columns: [{ field: "FirstName" }, { field: "LastName" }, {command: "destroy"}], <----------------------------- LINE 62
toolbar: [ "save", "cancel", "create"],
detailTemplate: kendo.template($("#template").html()),
detailInit: detailInit,
editable: true,
navigatable: true,
filterable: true,
scrollable: true
});
As you can see this is from an example in the blog section using php. Works great as a php file but in the tpl Smarty does not like it. What I did find is that to get around the problem use the {literal} {/literal} Smarty tags to ignore code within the section.