problem about smarty3-Collection of common programming errors


  • Syntax Error
    upgrade smarty3 cmsmadesimple
    I’m new to CMSMS and taking an older installation through a painful upgrade path to get it to the current version. One of the major changes involves using Smarty 3 for it’s templating engine. This change has broken a couple of the existing templates.The related CMSMS module is called “Product and Inventory Manager” which looks like it’s part of “Calguys Module Extensions”Here’s the error message I’m getting:Syntax Error in template “module_db_tpl:ProductsWithLocation;summary_default” on line 26

  • Dainis Abols
    php exception-handling smarty smarty3
    I have block try – catch and i want assign error to the template to $error. I tried:catch (Exception $e) {$smarty->assign(“error”, ‘Error! Details: ‘.$e->getMessage()); }Also tried:catch (Exception $e) {$error = $e->getMessage()); } $smarty->assign(“error”, $error);But when there is no error, smarty requires this variable and all crashes. Is there any way to deal with it without using if? Or may be i am doing wrong from the begining?

  • Athanatos
    php smarty smarty3
    My ajax php located in maindirexample/actions is calling a tpl file one folder up in maindirexample/templatesfetch(‘../templates/popupMyItems.tpl’); However this throws an error <br /> <b>Fatal error</b>: Uncaught exception ‘SmartyException’ with message ‘Unable to load template file ‘list-myItems.tpl’ in ‘../templates/popupMyItems.tpl’popupMyitems.tpl seems to be called ok, however list-myItems.tpl fails (this is included in popupMyitems.tpl) ..{foreachfrom=$uniquecategories i

  • Vipan Kumar
    php smarty3 server-configuration
    I have created project in smarty and now i am trying to host it on pagodabox.com. I have created application on pagodabox.com and uploaded all code on to this application but problem is this now i am unable to configure cache and compiler directory in pagodabox.com that’s why it output fetal error because cache and compiler directory is read only mode. I have try Boxfile to resolve this issue but failing to solve. I am not aware how i can make these directory writable. please help me. this is ur

  • fl3x7
    php codeigniter smarty codeigniter-2 smarty3
    Im currently using codeigniter 2 with ci-Smarty. Just been trying to add a smarty output filter but not having much luck. Its as if the function cannot be found or something?I am using a plugin as the output filter function and have the following code:LOCATION: /libraries/Smarty.php// Set email output filter $this->loadFilter(‘output’, ‘protect_email’);LOCATION: /third_party/Smarty/plugins/function.protect_email.phpfunction smarty_function_protect_email($tpl_output, Smarty_Internal_Template $

  • Hailwood
    php javascript escaping smarty3
    I am using the below code with smarty V3<script>$(function() {jwplayer(“video-player-{$v->id}”).setup( {file: “/webfiles/competitions/movies/{$v->file}”,skin: “/assets/jwplayer/skins/simplicity/simplicity.zip”,width: 446,height: 353,stretching: “fill”,flashplayer: “/assets/jwplayer/player.swf”} );} ); </script>The manual states:Note{literal}{/literal} tags are normally not necessary, as Smartyignores delimiters that are surrounded by whitespace. Be sure yourjavascript and CSS c

  • JochenJung
    include smarty block smarty3
    I have some templates written with Smarty 3:A layout page An index page An include pagelayout.tpl:{block “css”}{/block} {block “js”}{/block} {block “content”}{/block}index.tpl:{extends “layout.tpl”} {block “content”} content text {include “include.tpl”} {/block}include.tpl{block “js” append} include some extra js files for this included content {/block} include textBut I got a compiler exception:Fatal error: Uncaught exception ‘SmartyCompilerException’ with message ‘Syntax Error in template inc

  • lukaswilkeer
    smarty3
    What’s this? Does any error in the configuration file? Following is the full error.Fatal error: Uncaught exception ‘SmartyException’ with message ‘Unableto load template file ‘index.tpl” in/var/www/stoke/libs/sysplugins/smarty_internal_templatebase.php:127Stack trace: #0/var/www/stoke/libs/sysplugins/smarty_internal_templatebase.php(374):Smarty_Internal_TemplateBase->fetch(‘index.tpl’, NULL, NULL, NULL,true) #1 /var/www/stoke/index.php(41):Smarty_Internal_TemplateBase->display(‘index.tpl’) #2 {

  • Rajat
    php smarty smarty3
    My file structure:–header.php –smarty–templates– x.tpl–cache–configs–templates_c –articles– testPage.phpCode in header.php$smarty = new Smarty();$smarty->setTemplateDir(‘smarty/templates’); $smarty->setCompileDir(‘smarty/templates_c’); $smarty->setCacheDir(‘smarty/cache’); $smarty->setConfigDir(‘smarty/configs’);Code in testPage.php<?phpinclude(‘../header.php’);$smarty->display(‘x.tpl’); ?>I am hitting this error:PHP Fatal error: Uncaught exception ‘SmartyException

  • user861587
    php smarty echo combine smarty3
    Why doesn’t this work in Smarty?{my_function($test.’a1′)}It’s showing following error: Fatal error: Uncaught exception ‘SmartyCompilerException’ with message ‘Syntax Error in template “test.tpl” on line 1 “{my_function($test.’a1’)}” Unexpected “‘a1′”, expected one of: “{” , “$” , “identifier” , INTEGER’ in…

  • r4.
    kohana smarty kohana-3 smarty3
    I’m learning Kohana 3.2.0 together with KSmarty for Kohana 3. I’d like to write an anchor on the page like this:<a href=”http://www.mysite.cz/page/list”>Page list</a>I can build the url in the controller and pass it to Smarty as a variable but. Is there a way to build the anchor or URL in Smarty template (including “http://www.mysite.cz” part)?If it is not possible to build the anchor. Is it at least possible to build full URL?The Reason: I have a main template which includes another

  • kyyych
    zend-framework smarty3
    https://github.com/Domi-cc/SmartyModule thank you for the above module, I have integrated smarty3 into zend2 ,but i dont’t know how to pass vars to smarty,here is my application structure? config/ ? data/ ? module/? Application/? config/? language/? src/? Application/? Controller/IndexController.php*? view/? application/? index/index.tpl*? error/? layout/Module.php*? SmartyModule/ ? public/ ? vendor/init_autoloader.php*i made up some code in module/Application/src/Application/Controller/IndexCon

  • Jason
    php smarty3
    I can’t seem to find a way to escape the “@” sign in a smarty variable output block. Here’s my setup:$data = array(“myvar@display”=>4534534); $smarty->assign($data); Assign doco hereIn my template file:<body>{$myvar@display} </body>Output:Message: Undefined property: Smarty_Variable::$displayAny ideas how I can display that without changing the “@” sign (I am unable to modify this as it is a convention used throughout the application and I do not have control over this)Running

  • ken
    php smarty smarty3
    I have a smarty template that has been working fine for me for some time but for reasons I don’t quite understand one of the variables that I “assign” to the template is $activity_date and when I send in time information with my date information it has some surprising effects (aka, it works when “2012-12-27” is passed in but falls over in a bizzare way when “2012-12-27 00:00:00” is passed in. It might make a little more sense if the problems actually were related to some sort of template interac

  • grisevg
    smarty smarty3
    Is there a way to force Smarty 3 throw exceptions instead of notices? I want application to crash in there is undefined variable. In smarty 2 there was error_unassigned param, but looks like it’s removed in v3.

  • Athanatos
    smarty smarty3
    In my PHP file Using $smarty->config_load(‘en.conf’);I am getting the following :Notice: function call ‘config_load’ is unknown or deprecated. in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\ex\libs\sysplugins\smarty_internal_wrapper.php on line 57I am then changing the statement to @$smarty->config_load(‘en.conf’); and the error is hidden.However all my ajax scripts are failing at this point and in the ajax response using firebug, I can see a fatal error this time :

  • ken
    smarty smarty3
    I am trying to step a bit beyond the basic usage of Smarty and ran into a small problem using the default “capitalize” modifier. I am operating with the assumption that no explicit calls need to be made to use this operator so in my template I have the following:{* Smarty Part: Add-ins *}<div class=”control-group form-inline”> <label class=”control-label”>Add-ins:</label><div class=”controls “>{foreach $add_ins as $add_in}<label class=”checkbox inline”><input typ

  • Mihai Iorga
    php smarty smarty3
    So I have an old website which uses an older version of smarty, as today I wanted to upgrade to latest version, and it hit’s me with an error:[Fri Aug 19 11:21:19 2011] [error] [client ***.***.***.***] PHP Notice: Undefined property: Smarty::$allow_php_tag in /work/smarty3.1rc1/Smarty.class.php on line 592 [Fri Aug 19 11:21:19 2011] [error] [client ***.***.***.***] PHP Fatal error: Uncaught exception ‘SmartyCompilerException’ with message ‘Syntax Error in template “/work/templates/modules/main

  • Verbeia
    php codeigniter smarty eval smarty3
    I am trying to use one of CodeIgniter functions with smarty which the variable name is Dynamic. normally the function is called like this : {set_value(aaa, $f_aaa} <br>but in my code aaa is replaced with a dynamic value first part is easy : {set_value($row->Field, $f_aaa} <br>but I don’t know how to use eval in smarty for this situation .it should call the function with a loop (ex with following input/variable){set_value(name, $f_name} {set_value(address, $f_address} edit: I forgo

  • mspir
    php smarty smarty3
    I have the following code, that works for smarty 2.x {assign var=somename value=jsFunction($frontItemKey);}but smarty v3 throws an error:unknown function “jsFunction”How can I fix this?Thanks!

  • air4x
    php smarty smarty3 cmsmadesimple
    Hopefully someone can help me with this. I am using smarty within CMSMS and have something called a User Defined Tag running within my page. This contains the following code: $db = cmsms()->GetDb(); $menu = $smarty->get_template_vars(‘page’); $user_id = $smarty->get_template_vars(‘userid’); if (!isset($user_id)) { $user_id = -1; } // Getting menu items from DB $query = ‘SELECT * FROM ‘. cms_db_prefix() .’module_tools_options WHERE active = 1 AND user_id = ? AND menu = ? ORDER BY so

  • Paul DelRe
    smarty smarty3
    currently i change smarty 2 -> version 3but after i change got problem as below.SmartyCompilerException: Syntax Error in template “/home/test/engine/mobile9/template/t_footer.tpl” on line 28 “{php}” unknown tag “php” in /home/test/engine/modules/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 617after that i check smarty 3 documentations. it shown {php} is valid operator.

Web site is in building

I discovery a place to host code、demo、 blog and websites.
Site access is fast but not money