SmartyCompilerException unknown tag "include" - php

I've recently moved a website from a PHP 5.2 environment to 5.4.35.
The site uses Smarty 3.1 for templating and unfortunatley it's not a tool i'm familiar with. Since the big move we're getting unknown tag "include" errors.
I wondered if anyone in the community had come across this before?
Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "/var/www/vhosts/domain.com/httpdocs/templates/index.html" on line 1 "<!--{include file="_header.html"}-->" unknown tag "include"' in /var/www/vhosts/domain.com/httpdocs/lib/smarty3.1/libs/sysplugins/smarty_internal_templatecompilerbase.php on line 617
I have tried searching the Smarty forums with little success. Does anyone have any idea what I need to look for?

IMPORTANT NOTICE
{include_php} is deprecated from Smarty, use registered plugins to properly insulate presentation from the application code. As of Smarty 3.1 the {include_php} tags are only available from SmartyBC.
Source: https://www.smarty.net/docs/en/language.function.include.php.tpl

Related

How to attach stack trace to error log messages in PHP?

I run multiple WordPress sites which have multiple themes and plugins from multiple different authors. I always check my error log and try to contact the authors to fix bugs in their code, but a lot of them are logged as something like:
PHP Deprecated: wpmu_new_blog is <strong>deprecated</strong> since version 5.1.0! Use wp_insert_site instead. in /wp-includes/functions.php on line 5148
PHP Warning: array_merge(): Argument #3 is not an array in /wp-includes/class-wp-customize-widgets.php on line 376
PHP Warning: Error while sending QUERY packet. PID=23688 in /wp-includes/wp-db.php on line 2033
PHP Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in /wp-includes/wp-db.php on line 1635
As you can see, the warnings occurred in files inside wp-include, which are available to all plugin/theme/core authors, so there is no way for me to find out who called the deprecated function, passed the wrong function parameters or whatever they did.
I also cannot easily reproduce the error in a dev environment because I don't know what action triggered it.
Everything would be much easier if I could change some PHP (or even server) setting that would cause a stack trace to be appended to each error log message.
This is one of those things that, as common as my problem probably is, Google is unhelpful because all search results try to explain how to append the stack trace to my own code, not to anyone's code.
You could install the Xdebug extension to PHP, which overrides the error logging mechanism of PHP and adds stack traces to errors, warnings, etc. when enabled. See Xdebug documentation.

My Joomla site shows PHP error: failed to open stream

I am working on a Joomla site, and just recently updated PHP to 7.2, but my site started throwing errors. I have also updated Joomla to the latest version, but errors still appear. I'm not good in PHP and don't know how to fix it.
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Color has a deprecated constructor in /public_html/templates/jf_social/features/color.php on line 11
Warning: require_once(/public_html/libraries/joomla/document/html/renderer/head.php): failed to open stream: No such file or directory in /public_html/templates/jf_social/error.php on line 52
Fatal error: require_once(): Failed opening required '/public_html/libraries/joomla/document/html/renderer/head.php' (include_path='.:/php:/opt/cpanel/ea-php73/root/usr/share/pear') in /public_html/templates/jf_social/error.php on line 52
I think error comes from my Joomla template, I am using this one https://www.joomforest.com/joomla/templates/jf-social
I can't receive support from that template developers, because my subscription is expired, and changing the template will take a lot of time for me,
can you please anyone advise how to fix it?
Thank you very much!
Try to delete the line 52
require_once(/public_html/libraries/joomla/document/html/renderer/head.php)
from the File
/public_html/templates/jf_social/error.php
The renderer/head.php doesnt be supported any more in your joomla version. If there are no more errors, everything is fine, if not your template is not supported any more.
Then go to the file
/public_html/templates/jf_social/features/color.php
and edit the line
function Color($hex){
to
function __construct($hex){

Xcart Search Module issue

I am facing this syntax error in my search module. Can someone please look into this that what's exact issue.
// This is the path to the fts_instant_product_search.php file you uploaded.
{php}$x=parse_url($GLOBALS['smarty']->_tpl_vars['current_location']);$GLOBALS['smarty']->assign('searchPath',$x['path']);{/php}
searchPath = "{$searchPath}/";
It produces this error:
PHP Fatal error: Uncaught --> Smarty Compiler: Syntax error in
template
"/home/noveltie/public_html/xcart475/skin/lumino_responsive/customer/fts_instant_product_search.tpl"
on line 79
"{php}$x=parse_url($GLOBALS['smarty']->_tpl_vars['current_location']);$GLOBALS['smarty']->assign('searchPath',$x['path']);{/php}"
unknown tag "php" <-- thrown in
/home/xxx/public_html/xcart475/include/lib/smarty3/sysplugins/smarty_internal_templatecompilerbase.php
on line 79
X-Cart 4.7.5 uses Smarty version 3.1, which does not allow {php} tag:
http://www.smarty.net/docs/en/language.function.php.tpl
IMPORTANT NOTICE
{php} tags are deprecated from Smarty, and should not be used.
Put your PHP logic in PHP scripts or plugin functions instead.
As of Smarty 3.1 the {php} tags are only available from SmartyBC.
Your options are:
Contact the skin developer and ask them to change the skin's code, so it would be compliant with smarty 3.1
Install aforementioned backward compatibility wrapper from here:
http://www.smarty.net/docs/en/bc.tpl

Smarty Error on Wamp server

I got an error when installing php openCRM software myITCRM.Fatal error: Uncaught --> Smarty: Call of unknown method 'load_filter'. <-- thrown in C:\wamp\bin\php\php5.5.12\Smarty\libs\sysplugins\smarty_internal_templatebase.php on line 858.
load_filter() was used in Smarty 2.0, but became loadFilter() in Smarty 3.0. My guess is that your application's Smarty libraries have been upgraded, but this piece of code hasn't changed
myITCRM will not work in php 5.5 .that's why i am getting this error

ß Fatal error: Cannot redeclare get_header

Code Wizards,
I currently have a website that uses wordpress, and recently had some malware problems. I deleted some files without thinking what they did. While trying to restore the site after getting internal sever errors, I soon started to get errors similar to the one below. However I'am stuck on this one, on what it means/wants me to do.
ß Fatal error: Cannot redeclare get_header() (previously declared in /hermes/bosnaweb10a/b2702/ipg.cjhgraphicdesigncom/wp/wp-includes/general-template.php:21) in /hermes/bosnaweb10a/b2702/ipg.cjhgraphicdesigncom/wp/wp-includes/link-template.php on line 43
I would really appreciate any knowledge on this, my php skills are not the best.
Thank you!

Categories