Update code examples to use Smarty\Smarty and autoload instead of require_once calls and new Smarty

This commit is contained in:
Simon Wisselink
2023-02-06 15:18:47 +01:00
parent cf84802072
commit 7a323b7345
21 changed files with 44 additions and 28 deletions

View File

@@ -50,7 +50,7 @@ parameters:
<?php
include('Smarty.class.php');
use Smarty\Smarty;
$smarty = new Smarty;
// force compilation of all config files

View File

@@ -60,7 +60,7 @@ parameters:
<?php
include('Smarty.class.php');
use Smarty\Smarty;
$smarty = new Smarty;
// force compilation of all template files

View File

@@ -30,7 +30,7 @@ be used to control which variables are seen by which templates.
<?php
include('Smarty.class.php');
use Smarty\Smarty;
$smarty = new Smarty;
// create data object with its private variable scope

View File

@@ -80,7 +80,7 @@ following parameters:
<?php
include('Smarty.class.php');
use Smarty\Smarty;
$smarty = new Smarty;
// create template object with its private variable scope

View File

@@ -30,7 +30,7 @@ PARAMETER.COMPILEID
<?php
include('Smarty.class.php');
use Smarty\Smarty;
$smarty = new Smarty;
$smarty->setCaching(true);

View File

@@ -24,6 +24,7 @@ otherwise. If security is enabled, classes registered with
<?php
use Smarty\Smarty;
class Bar {
$property = "hello world";
@@ -44,12 +45,14 @@ otherwise. If security is enabled, classes registered with
<?php
use Smarty\Smarty;
namespace my\php\application {
class Bar {
$property = "hello world";
}
}
$smarty = new Smarty();
$smarty->registerClass("Foo", "\my\php\application\Bar");

View File

@@ -25,7 +25,7 @@ plugin types.
<?php
use Smarty\Smarty;
$smarty = new Smarty();
$smarty->registerDefaultPluginHandler('my_plugin_handler');

View File

@@ -14,7 +14,7 @@ installation can be accessed. It does output a corresponding protocol.
<?php
require_once('Smarty.class.php');
use Smarty\Smarty;
$smarty = new Smarty();
$smarty->testInstall();
?>