|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
XPSystemServices Smarty Rookie
Joined: 20 Apr 2017 Posts: 7
|
Posted: Sat Feb 16, 2019 12:54 pm Post subject: Smarty bugged on PHP 5.2 |
|
|
According smarty documentation:
https://www.smarty.net/docs/en/installation.tpl
Smarty requires a web server running PHP 5.2 or greater.
But you are using code constructions that is not compatible with PHP 5.2
CODE TO REPRODUCE:
index.php
Code: | <?php
require_once('smarty/Smarty.class.php');
class MyClass {
static function MyTag($params, $content, &$smarty, &$repeat) {
return $content;
}
function __construct() {
$smarty = new Smarty($this);
$smarty->template_dir = 'templates/';
$smarty->compile_dir = 'compiles/';
$smarty->registerPlugin('block', 'mytag', array(__CLASS__, 'MyTag'));
$smarty->display('my.html');
}
}
new MyClass();
?>
|
templates/my.html
Code: | {mytag}Hello World!{/mytag}
|
The code above works fine in latest versions of PHP.
But it doesn't work in PHP 5.2 (tested in PHP 5.2.17).
It fails because in compiled templates you are using code generations similar to this:
$MyClass = 'MyClass';
echo $MyClass::MyTag();
that is not supported by PHP 5.2
Reference the class using a variable was added in PHP 5.3:
http://php.net/manual/en/language.oop5.paamayim-nekudotayim.php
PLEASE FIX IT! |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sat Feb 16, 2019 3:03 pm Post subject: |
|
|
PHP below 7.1 is unsupported.
Even 7.1 is in security support only.
http://php.net/eol |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|