This is a migrated thread and some comments may be shown as answers.

php, pdo, tpl and kendo

3 Answers 84 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
richard
Top achievements
Rank 1
richard asked on 02 May 2012, 08:53 PM
well I can successfully use php, pdo and kendo together but when I try to put kendo web widgets into TPL I get a Smarty compile error on something that works perfectly well in a php file.

should Kendo work in Smarty tpl files?

thanks,
Richard

3 Answers, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 03 May 2012, 01:03 PM
Hello,

Is it possible for you to provide more information regarding the problem? A source code and the error message would allow us to provide better assistance. 

All the best,
Petyo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
richard
Top achievements
Rank 1
answered on 03 May 2012, 01:16 PM
Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "modules\grid.tpl" on line 62 "columns: [{ field: &quot;FirstName&quot; }, { field: &quot;LastName&quot; }, {command: &quot;destroy&quot;}]," - 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.
0
Petyo
Telerik team
answered on 03 May 2012, 06:45 PM
Hi,

This seems like a general issue with Smarty and embedded JavaScript, described in their FAQ.

http://smarty.incutio.com/?page=SmartyFrequentlyAskedQuestions  

Search for 

Q: Is there a way to escape '{' and '}' in html? 


(they do not have anchors for the FAQ section). 

All the best,
Petyo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
General Discussions
Asked by
richard
Top achievements
Rank 1
Answers by
Petyo
Telerik team
richard
Top achievements
Rank 1
Share this question
or