{"id":2896,"date":"2014-03-10T03:39:33","date_gmt":"2014-03-10T03:39:33","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/10\/phpsmartysmarty3related-issues-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:47:11","modified_gmt":"2022-08-30T15:47:11","slug":"phpsmartysmarty3related-issues-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/10\/phpsmartysmarty3related-issues-collection-of-common-programming-errors\/","title":{"rendered":"php,smarty,smarty3Related issues-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/0d67225ae59a00e7380c72690d64871e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAlan Moore<br \/>\nphp json utf-8 character-encoding<br \/>\nI use JSON to encode an array, and I get a string like this:{&#8220;name&#8221;:&#8221;\\u00fe\\u00fd\\u00f0\\u00f6\\u00e7&#8243;}Now I need to convert this to ISO-8859-9. I tried the following but it fails:header(&#8216;Content-type: application\/json; charset=ISO-8859-9&#8217;); $json = json_encode($response); $json = utf8_decode($json); $json = mb_convert_encoding($json, &#8220;ISO-8859-9&#8221;, &#8220;auto&#8221;); echo $json;It doesnt seem to work. What am I missing?Thank you for your time.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/Zv0E2.gif?s=32&amp;g=1\" \/><br \/>\nMr Coder<br \/>\nphp facebook-fql where<br \/>\nI am trying to use two WHERE clauses in one fql query SELECT uid, pic, pic_square, name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND WHERE strstr(&#8216;ab&#8217;,name)but getting errorParser error: unexpected &#8216;WHERE&#8217; at position<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/949c8d415766f277a97f33a35d1997aa?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nDoon<br \/>\nphp datetime<br \/>\nI&#8217;ve used DateTime::createFromFormat() to parse string into date before, but today I found a problem and I get null from this call.echo $date_string; $test = DateTime::createFromFormat(&#8216;M d Y, H:i:s T&#8217;, trim($date_string)); echo $test-&gt;format(&#8216;Y-m-d H:i:s&#8217;);Output:Oct 16 2013, 15:45:02 CEST( ! ) Fatal error: Call to a member function format() on a non-object in (&#8230;) on line 51Where line 51 is the last line where I call format().So, am I missing something? Thanks in advance!The output of Date<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/0930a78c2a8a3a19b91d7bc64d229f3f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMostafa Talebi<br \/>\njavascript php jquery<br \/>\nWe write a custom function&#8217;s arguments in PHP like this:function something ($arg = &#8220;&#8221;) {\/\/ then do something }How this should be done in jquery?this seems not to work:function jq_something ($arg = &#8220;&#8221;) {}<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b07c67edfcc5d1496365503712de5c2a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nGolezTrol<br \/>\nphp<br \/>\ndefine(&#8220;QUERY&#8221;,&#8221;INSERT INTO rft_media_invention . &#8221; &#8221; (dbInventionFileType, dbStaffId, dbInventionFileName, dbInventionFileContent)&#8221; . &#8220;VALUES (?, ?, ?, ?)&#8221;);Its always giving me this error Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in p3t\\phpappfolder\\public_php\\cw\\UC213.php on line 20anyone knows if my query is fully correct?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/91a78cf1465182161a79685058d8b39b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nNanne<br \/>\nphp mysql if-statement while-loop<br \/>\nI have the following php code:&lt;?phpif (!isset($_REQUEST[&#8216;search&#8217;])){while(($write=mysql_fetch_array($gamesearched)) != null){echo &#8220;Found!&#8221;;}else{echo &#8220;No results&#8221;;}} ?&gt;And it&#8217;s giving me an error:Parse error: syntax error, unexpected &#8216;else&#8217; (T_ELSE) inC:\\php\\www\\Gameplay\\backgame.php on line 41<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/40de750233b3ce8268f235ba0b6a489b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nteresko<br \/>\nphp php-parse-error<br \/>\nWhen I do:class MyClass {public $copy = file_get_contents(&#8216;somefile.mdown&#8217;); }I get:PHP Parse error: syntax error, unexpected &#8216;(&#8216;, expecting &#8216;,&#8217; or &#8216;;&#8217; \\ in \/file.php on line 25I&#8217;m new to classes in PHP, but not to OOP.I can, of course, just do file_get_contents outside of the class and all is well. What&#8217;s up with this?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/noj80.png?s=32&amp;g=1\" \/><br \/>\nHugo<br \/>\nphp parsing<br \/>\nI get the following error;Parse error: syntax error, unexpected T_STRING in D:\\XAMPP\\xampp\\htdocs\\site\\register.php on line 95Line 95 is;if (strstr($email, &#8220;@&#8221;) &amp;&amp; strstr($email, &#8220;.&#8221;) strlen($email) &gt;=6))Please help, I don&#8217;t know what&#8217;s wrong :\/ It all looks fine to me. Thanks In Advance!<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f90c1430d35e7f0789cd3d24d21b9a22?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser327046<br \/>\nphp zend-framework cron set-include-path<br \/>\nI wrote a command line utility using Zend Framework to do some nightly reporting. It uses a ton of the same functionality the accompanying site. It works great when I run it by hand, but when I run it on cron I have include path issues. Seems like it should be easily fixed with set_include_path, but maybe I&#8217;m missing something?My directory structure looks like this:\/var\/www\/clientname\/applicationGlobals.phpcommandlinecommandline_bootstrap.php public_htmlpublic_bootstrap.php libraryZ<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/222e3372a69d9c2f81cc34413d8308bf?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser356556<br \/>\nphp html parsing<br \/>\nI was just helped with this question but I can&#8217;t get it to move to the next block of HTML.$html = file_get_html(&#8216;http:\/\/music.banadir24.com\/singer\/aasha_abdoo\/247.html&#8217;);$urls = $html-&gt;find(&#8216;table[width=100%] table tr&#8217;);foreach($urls as $url){$song_name = $url-&gt;children(2)-&gt;plaintext;$url = $url-&gt;children(6)-&gt;children(0)-&gt;href; }It returns the list of the names of the first album (Deesco) but it does not continue to the next album (The Best Of Aasha)? It just gives me this er<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a9f08c4ce7e43b2bf332357d84efb857?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPaul Rusu<br \/>\nphp smarty whmcs<br \/>\nI have added the function.bnr_exchange.php to the includes\/smarty\/plugins directory. It contains smarty_function_bnr_exchange which returns a string.I also modified invoicepdf.tpl $pdf-&gt;Cell(0,6,{bnr_exchange} . &#8221;,0,1,&#8217;L&#8217;,&#8217;1&#8242;);which gives error: unexpected { I tried with &#8220;{bnr_exchange}&#8221; but then it writes the text {bnr_exchange}If i simply write {bnr_exchange} in the template it says unexpected } in that line. So it doesn&#8217;t recognize the plugin &#8220;bnr_exchange&#8221;. My question is how do I tell w<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/d27f97e2545cba135fb1b7ceb077dc11?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nClaude Grecea<br \/>\nphp pdo smarty<br \/>\nI am having a problem with Smarty passing a PDO Object to Smarty it just doesn&#8217;t like =&gt;. Is there a trick to get around this problem?Here is he error:{assign var=&#8217;brgdatas&#8217; value=&#8221;{$brgObj-&gt;fetchOneBrg(array(&#8216;id&#8217;=&gt;{$ststres[ststval].to_id}&#8217;))}&#8221;}&#8221; &#8211; Unexpected &#8220;=&gt;&#8221;, expected one of: &#8220;&#8221;,&#8221;&#8221; , &#8220;)Here is the code I am working with:{section name=ststval loop=$ststres}{if $ststres[ststval].type == 2}{assign var=&#8217;brgdatas&#8217; value=&#8221;{$brgObj-&gt;fetchOneBrg(array(&#8216;id&#8217;=&gt;{$ststres[ststval].to<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f016b2c06d0fa6495757c25dc8b37204?s=32&amp;d=identicon&amp;r=PG&amp;f=1\" \/><br \/>\nJerielle<br \/>\njavascript jquery smarty<br \/>\nHello guys I have a problem in getting textboxes inputs in my jquery using ID. Ok here&#8217;s my code.&lt;script type=&#8221;text\/javascript&#8221;&gt;var globalBase_Url = &#8220;{$base_url}&#8221;; \/\/OK NO ERROR var name = &#8220;&#8221;;var desc = &#8220;&#8221;;{literal}$(document).ready(function(){$(&#8216;#add_cat&#8217;).on(&#8216;click&#8217;,function(){$(&#8216;#add_category&#8217;).show(&#8216;slide&#8217;);});$(&#8216;#submit&#8217;).on(&#8216;click&#8217;,function(){jquery.ajax({ var name = $(&#8216;#category_name&#8217;).val(); \/\/this is the errorvar desc = $(&#8216;#description&#8217;).val(); \/\/ this is the error});});});{\/li<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f8e2e57e9153e1a01b0f834dfe8dd402?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nNemoPS<br \/>\njquery ajax smarty<br \/>\nI need to output a couple of lines of escaped html using ajax, with the object being generated by smarty. However, I keep getting unexpected token even if I used both nl2br and |regex_replace:&#8217;\/[\\r\\n]\/&#8217; : &#8216;&lt;br\/&gt;&#8217;.Here is the troublesome code:&#8221;value&#8221;: &#8220;&amp;lt;div class=&amp;quot;ps-header-links&amp;quot;&amp;gt;&lt;br\/&gt; &lt;br\/&gt; &amp;lt;ul&amp;gt;&lt;br\/&gt; &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;http:\/\/prestashop.com&amp;quot; ti<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/aee3b44e5f0b4dfa0e2da672897b3751?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nj0k<br \/>\njavascript smarty prestashop<br \/>\nI&#8217;m developing a Prestashop website, and I&#8217;m getting a &#8220;SyntaxError: unterminated string literal&#8221; javascript error. The problem is when I get an address, this works nice:,&#8221;address1&#8243;:&#8221;Pza libertad&#8221; ,&#8221;address2&#8243;:&#8221;4&amp;ordm; 3&amp;ordf;&#8221; ,&#8221;postcode&#8221;:&#8221;08905&#8243;The problem comes here:,&#8221;address1&#8243;:&#8221;Plaza libertad 3&#8243;,&#8221;address2&#8243;:&#8221; 4&amp;ordm;3&amp;ordf;&#8221;,&#8221;postcode&#8221;:&#8221;08905&#8243;This code is generated like this:{foreach from=$type.formated_fields_values key=pattern_name item=field_name name=inv_loop} {if !$smarty.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/58fcc9080637afe2099853d0c1144713?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nBas<br \/>\nphp variables smarty<br \/>\nI have the following code and the output.If i print_r, normal echo {} of foreach, i am getting the number 1?What do i do wrong?!Controller:if( $checkOrderNumber == &#8221; || $checkOrderNumber == NULL ){$var = &#8216;&lt;a class=&#8221;tool-link&#8221; href=&#8221;url.php?dispatch=orders.details&amp;order_id=&#8217;. $_REQUEST[&#8216;order_id&#8217;] .&#8217;&amp;sendsurvey=yes&#8221;&gt;Send FBC invitation&lt;\/a&gt;&#8217;; }else{$var = &#8216;&lt;a href=&#8221;#&#8221;&gt;FBC has been sent&lt;\/a&gt;&#8217;; }Registry::get(&#8216;view&#8217;)-&gt;assign(&#8216;var&#8217;, $var);Smarty TPL:{assign var=&#8221;var<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/c0d4c48fe5f5e8499b2e3241c3de4dc0?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\ndazfx<br \/>\nphp function smarty prestashop<br \/>\nIs a function that is called in product-list.php.{mycat id_product_my=$product.id_product}In this form, write a line above, the variable($product.id_product) is not passed to function:{$product.id_product}returns right result as id.{mycat id_product_my=15}returns right result as categories of product with id(15).What&#8217;s wrong?&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;php funct:function smarty_compiler_mycat($params, &amp;$smarty) {$id_product_my = $params[&#8216;id_product_my&#8217;];$ret = &#8220;&#8221;;if ($row = D<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/1187e02aff139da432a1487cb396480e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMesser<br \/>\nphp smarty<br \/>\nI have a project that uses Smarty template engine (2.6). Point is I can&#8217;t have it save files locally as it would mean saving to the repository. Same with cache.My question is &#8211; how should I implement compiling templates to, for example, memcache?I was playing with stream wrapper for it but maybe someone has a better solution?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/d3f93faea9d120816dfa2330d601eefb?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nrag<br \/>\nphp smarty<br \/>\nWARNING [2] include(somepath\/templates_c\/%%B0^B01^B019F522%%login.htm.php) [function.include]: failed to open stream: No such file or directory on Line No 1871 in somepath\/Smarty.class.php Error!: An internal error occurred during runtime.Any body please tell me why this error is occuring..<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/4fb133b33b847eef48644c7e00dde72c?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nDainis Abols<br \/>\nphp exception-handling smarty smarty3<br \/>\nI have block try &#8211; catch and i want assign error to the template to $error. I tried:catch (Exception $e) {$smarty-&gt;assign(&#8220;error&#8221;, &#8216;Error! Details: &#8216;.$e-&gt;getMessage()); }Also tried:catch (Exception $e) {$error = $e-&gt;getMessage()); } $smarty-&gt;assign(&#8220;error&#8221;, $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?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/83a5bc139910572dc4d618fd6f4758ff?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nSyntax Error<br \/>\nupgrade smarty3 cmsmadesimple<br \/>\nI&#8217;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&#8217;s templating engine. This change has broken a couple of the existing templates.The related CMSMS module is called &#8220;Product and Inventory Manager&#8221; which looks like it&#8217;s part of &#8220;Calguys Module Extensions&#8221;Here&#8217;s the error message I&#8217;m getting:Syntax Error in template &#8220;module_db_tpl:ProductsWithLocation;summary_default&#8221; on line 26<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/4fb133b33b847eef48644c7e00dde72c?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nDainis Abols<br \/>\nphp exception-handling smarty smarty3<br \/>\nI have block try &#8211; catch and i want assign error to the template to $error. I tried:catch (Exception $e) {$smarty-&gt;assign(&#8220;error&#8221;, &#8216;Error! Details: &#8216;.$e-&gt;getMessage()); }Also tried:catch (Exception $e) {$error = $e-&gt;getMessage()); } $smarty-&gt;assign(&#8220;error&#8221;, $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?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/574a32b2bc2c7c0c9a0466a6f2689862?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAthanatos<br \/>\nphp smarty smarty3<br \/>\nMy ajax php located in maindirexample\/actions is calling a tpl file one folder up in maindirexample\/templatesfetch(&#8216;..\/templates\/popupMyItems.tpl&#8217;); However this throws an error &lt;br \/&gt; &lt;b&gt;Fatal error&lt;\/b&gt;: Uncaught exception &#8216;SmartyException&#8217; with message &#8216;Unable to load template file &#8216;list-myItems.tpl&#8217; in &#8216;..\/templates\/popupMyItems.tpl&#8217;popupMyitems.tpl seems to be called ok, however list-myItems.tpl fails (this is included in popupMyitems.tpl) ..{foreachfrom=$uniquecategories i<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/Rj5b5.jpg?s=32&amp;g=1\" \/><br \/>\nVipan Kumar<br \/>\nphp smarty3 server-configuration<br \/>\nI 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&#8217;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<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/df8f1c2a3adda939fdbc04d7f8140faa?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nfl3x7<br \/>\nphp codeigniter smarty codeigniter-2 smarty3<br \/>\nIm 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-&gt;loadFilter(&#8216;output&#8217;, &#8216;protect_email&#8217;);LOCATION: \/third_party\/Smarty\/plugins\/function.protect_email.phpfunction smarty_function_protect_email($tpl_output, Smarty_Internal_Template $<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/F4W2b.jpg?s=32&amp;g=1\" \/><br \/>\nHailwood<br \/>\nphp javascript escaping smarty3<br \/>\nI am using the below code with smarty V3&lt;script&gt;$(function() {jwplayer(&#8220;video-player-{$v-&gt;id}&#8221;).setup( {file: &#8220;\/webfiles\/competitions\/movies\/{$v-&gt;file}&#8221;,skin: &#8220;\/assets\/jwplayer\/skins\/simplicity\/simplicity.zip&#8221;,width: 446,height: 353,stretching: &#8220;fill&#8221;,flashplayer: &#8220;\/assets\/jwplayer\/player.swf&#8221;} );} ); &lt;\/script&gt;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<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/d05a145b7625208633fb1707df2b9b6a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJochenJung<br \/>\ninclude smarty block smarty3<br \/>\nI have some templates written with Smarty 3:A layout page An index page An include pagelayout.tpl:{block &#8220;css&#8221;}{\/block} {block &#8220;js&#8221;}{\/block} {block &#8220;content&#8221;}{\/block}index.tpl:{extends &#8220;layout.tpl&#8221;} {block &#8220;content&#8221;} content text {include &#8220;include.tpl&#8221;} {\/block}include.tpl{block &#8220;js&#8221; append} include some extra js files for this included content {\/block} include textBut I got a compiler exception:Fatal error: Uncaught exception &#8216;SmartyCompilerException&#8217; with message &#8216;Syntax Error in template inc<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/9957cfe26be1f789e5b810060ad6ae81?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nlukaswilkeer<br \/>\nsmarty3<br \/>\nWhat&#8217;s this? Does any error in the configuration file? Following is the full error.Fatal error: Uncaught exception &#8216;SmartyException&#8217; with message &#8216;Unableto load template file &#8216;index.tpl&#8221; 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-&gt;fetch(&#8216;index.tpl&#8217;, NULL, NULL, NULL,true) #1 \/var\/www\/stoke\/index.php(41):Smarty_Internal_TemplateBase-&gt;display(&#8216;index.tpl&#8217;) #2 {<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/7f6b4f4915711d77a68aa9a4a2604cd0?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nRajat<br \/>\nphp smarty smarty3<br \/>\nMy file structure:&#8211;header.php &#8211;smarty&#8211;templates&#8211; x.tpl&#8211;cache&#8211;configs&#8211;templates_c &#8211;articles&#8211; testPage.phpCode in header.php$smarty = new Smarty();$smarty-&gt;setTemplateDir(&#8216;smarty\/templates&#8217;); $smarty-&gt;setCompileDir(&#8216;smarty\/templates_c&#8217;); $smarty-&gt;setCacheDir(&#8216;smarty\/cache&#8217;); $smarty-&gt;setConfigDir(&#8216;smarty\/configs&#8217;);Code in testPage.php&lt;?phpinclude(&#8216;..\/header.php&#8217;);$smarty-&gt;display(&#8216;x.tpl&#8217;); ?&gt;I am hitting this error:PHP Fatal error: Uncaught exception &#8216;SmartyException<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/e0d73436861c9b54bbf2a5ec26c8ac76?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser861587<br \/>\nphp smarty echo combine smarty3<br \/>\nWhy doesn&#8217;t this work in Smarty?{my_function($test.&#8217;a1&#8242;)}It&#8217;s showing following error: Fatal error: Uncaught exception &#8216;SmartyCompilerException&#8217; with message &#8216;Syntax Error in template &#8220;test.tpl&#8221; on line 1 &#8220;{my_function($test.&#8217;a1&#8217;)}&#8221; Unexpected &#8220;&#8216;a1&#8242;&#8221;, expected one of: &#8220;{&#8221; , &#8220;$&#8221; , &#8220;identifier&#8221; , INTEGER&#8217; in&#8230;<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Alan Moore php json utf-8 character-encoding I use JSON to encode an array, and I get a string like this:{&#8220;name&#8221;:&#8221;\\u00fe\\u00fd\\u00f0\\u00f6\\u00e7&#8243;}Now I need to convert this to ISO-8859-9. I tried the following but it fails:header(&#8216;Content-type: application\/json; charset=ISO-8859-9&#8217;); $json = json_encode($response); $json = utf8_decode($json); $json = mb_convert_encoding($json, &#8220;ISO-8859-9&#8221;, &#8220;auto&#8221;); echo $json;It doesnt seem to work. What am [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,8],"tags":[],"class_list":["post-2896","post","type-post","status-publish","format-standard","hentry","category-uncategorized","category-zend-framework"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2896","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2896"}],"version-history":[{"count":1,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2896\/revisions"}],"predecessor-version":[{"id":8910,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2896\/revisions\/8910"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2896"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2896"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2896"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}