Xcart Search Module issue - php

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

Related

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){

Very simple Wordpress plugin triggers fatal error when one tries activating it (PHP v 7)

I am diagnosing an issue with WP_cron(), so I wrote a very short app to list cron() tasks that are pending.
<? php
/*
Plugin Name: My WP-Cron Test
(there are more comments here but I left them out for brevity)
*/
function wpcron_print_tasks() {
echo '<pre>';
print_r( _get_cron_array() );
echo '</pre>';
}
?>
Attempting to activate this tiny plugin leads to the following:
Plugin could not be activated because it triggered a fatal error.
Parse error: syntax error, unexpected 'function' (T_FUNCTION) in
/latamconnex/wp-content/plugins/my-wp-cron-test/my-wp-cron-test.php on
line 12
Line 12 triggers this according to the compiler, i.e. wpcron_print_tasks().
Somehow, even if this plugin only had a line with an echo command, it triggers the error.
Is there something basic I am missing about building a simple plugin?
Basically, I'd like to know what I need to know in order for even the simplest of plugins to activate.
System details: WordPress 4.7, PHP v. 7.0.13, deployed online with Pressable.com
Q1: Why is the error happening?
Let's look at what the error says. The message you get tells you what the problem is and where it's throwing the error. Let's break it down.
Plugin could not be activated because it triggered a fatal error. Parse error: syntax error, unexpected 'function' (T_FUNCTION) in /latamconnex/wp-content/plugins/my-wp-cron-test/my-wp-cron-test.php on line 12
It's a "syntax error"
It's located in the file /latamconnex/wp-content/plugins/my-wp-cron-test/my-wp-cron-test.php
The error is thrown on line 12 of that file.
It's telling you there is a syntax error on or before line 12 of that file.
Looking at your code, line 1 has an error in it. Do you see it? You have <? php on line 1. PHP is not going to recognize that line as the opening PHP tag. Why? There's a space in between the ? and php.
Change that line to <?php. Notice, there's no space.
Make sure there are no other syntax errors between line 1 and 12.
Tip: Remove the Closing PHP Tag
You don't need the closing PHP tag ?> at the end of the file. I recommend removing the closing PHP tag.
Why? Any extra spaces or lines after that tag will cause the dreaded white screen of death. You can see the conversation about it here on Stack Overflow.
The best practice here is to omit the optional closing tag from all PHP files.
Q2:
Basically, I'd like to know what I need to know in order for even the simplest of plugins to activate.
First, WordPress has to recognize your code as a "plugin." Then once it finds it, then it's available for activation. There does not have to be a single line of code in the file for it to be activated.
How does WordPress recognize the plugin?
WordPress searches each folder in the wp-content/plugins folder. It's looking in the root of each folder for a bootstrap file.
What makes a file the "bootstrap?"
It's the file header (DocBlock) that identifies the plugin and makes it available to WordPress. That's your bootstrap file.
WordPress searches in the plugin folder's root for the file that has the properly structured file header.
The structure is defined in this Header Requirements document.
What should be in a plugin file?
All that's needed for the file to be activated is:
The opening PHP tag, i.e. <?php
The file's DocBlock
That's it. Now it's added to the list of plugins in Plugins > Installed Plugins (in the WordPress back-end admin).

SmartyCompilerException unknown tag "include"

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

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

smarty not working on new server PHP Version 5.2.6

Warning: preg_match() [function.preg-match]: Compilation failed: repeated subpattern is too long at offset 18454 in /Smarty_Compiler.class.php on line 454
Fatal error: Smarty error: [in login.tpl line 1]: syntax error: unrecognized tag: php (Smarty_Compiler.class.php, line 455)
this message coming.. it was working perfect on dev server but on live server its not working.
Dev php version was 5.2.14
new server has PHP Version 5.2.6
is this the problem?
What smarty version are you using?
This thread seems to imply it has to do with a combination of Smarty versions and php version:
http://www.smarty.net/forums/viewtopic.php?t=14563
For most users the sollution seems to be to downgrade Smarty from 2.6.21 to 2.6.20
It's kind of an old thread though, so check if it applies, but it seems akin to your problem.
Which version you are using ?
Use the latest version of smarty it might solve your problem.

Categories