{"id":7176,"date":"2014-05-27T08:58:21","date_gmt":"2014-05-27T08:58:21","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/27\/smarty-output-filters-with-codeigniter-and-ci-smarty-not-callable-error-collection-of-common-programming-errors\/"},"modified":"2014-05-27T08:58:21","modified_gmt":"2014-05-27T08:58:21","slug":"smarty-output-filters-with-codeigniter-and-ci-smarty-not-callable-error-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/27\/smarty-output-filters-with-codeigniter-and-ci-smarty-not-callable-error-collection-of-common-programming-errors\/","title":{"rendered":"Smarty output filters with Codeigniter and Ci-Smarty &ldquo;not callable&rdquo; error-Collection of common programming errors"},"content":{"rendered":"<p>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?<\/p>\n<p>I am using a plugin as the output filter function and have the following code:<\/p>\n<p><strong>LOCATION:<\/strong> \/libraries\/Smarty.php<\/p>\n<pre><code>\/\/ Set email output filter\n$this-&gt;loadFilter('output', 'protect_email');\n<\/code><\/pre>\n<p><strong>LOCATION:<\/strong> \/third_party\/Smarty\/plugins\/function.protect_email.php<\/p>\n<pre><code>function smarty_function_protect_email($tpl_output, Smarty_Internal_Template $template)\n{\n    $tpl_output =\n       preg_replace('!(\\S+)@([a-zA-Z0-9\\.\\-]+\\.([a-zA-Z]{2,3}|[0-9]{1,3}))!',\n                    '$1%40$2', $tpl_output);\n    return $tpl_output;\n}\n<\/code><\/pre>\n<p>The above seems to throw the following smarty error:<\/p>\n<blockquote>\n<p>Fatal error: Uncaught exception &#8216;SmartyException&#8217; with message &#8216;outputfilter &#8220;protect_email&#8221; not callable&#8217; in \/home\/something\/public_html\/application\/third_party\/Smarty\/sysplugins\/smarty_internal_templatebase.php:717 Stack trace: #0 \/home\/something\/public_html\/application\/libraries\/Smarty.php(46): Smarty_Internal_TemplateBase-&gt;loadFilter(&#8216;output&#8217;, &#8216;protect_email&#8217;) #1 \/home\/something\/public_html\/system\/core\/Loader.php(1095): CI_Smarty-&gt;__construct(Array) #2 \/home\/something\/public_html\/system\/core\/Loader.php(975): CI_Loader-&gt;_ci_init_class(&#8216;Smarty&#8217;, &#8221;, NULL, NULL) #3 \/home\/something\/public_html\/system\/core\/Loader.php(216): CI_Loader-&gt;_ci_load_class(&#8216;smarty&#8217;, NULL, NULL) #4 \/home\/something\/public_html\/application\/libraries\/MY_Parser.php(29): CI_Loader-&gt;library(&#8216;smarty&#8217;) #5 \/home\/something\/public_html\/system\/core\/Loader.php(1099): MY_Parser-&gt;__construct() #6 \/home\/something\/public_html\/system\/core\/Loader.php(938): CI_Loader-&gt;_ci_init_class(&#8216;Parser&#8217;, &#8216;MY_&#8217;, NULL, NULL) #7 \/home\/something\/public_html\/system\/core\/Loader.php(216): CI_Loa in \/home\/something\/public_html\/application\/third_party\/Smarty\/sysplugins\/smarty_internal_templatebase.php on line 717<\/p>\n<\/blockquote>\n<p>Sorry about it being so long! Just thought seeing the whole error may help.<\/p>\n<p>Thanks a lot for reading and hope someone can help.<\/p>\n<p>&#8211;&gt;EDIT Also just tried to explicitly set the plugins directory location using:<\/p>\n<pre><code>$this-&gt;setPluginsDir(config_item('plugin_directory'));\n<\/code><\/pre>\n<p>The echoed out the location which is correct but still get the same problem \ud83d\ude41<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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-&gt;loadFilter(&#8216;output&#8217;, &#8216;protect_email&#8217;); [&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],"tags":[],"class_list":["post-7176","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7176","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=7176"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7176\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}