PHP code example of xoops / smartyextensions

1. Go to this page and download the library: Download xoops/smartyextensions library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

xoops / smartyextensions example snippets


use Xoops\SmartyExtensions\ExtensionRegistry;
use Xoops\SmartyExtensions\Extension\TextExtension;
use Xoops\SmartyExtensions\Extension\SecurityExtension;

$registry = new ExtensionRegistry();
$registry->add(new TextExtension());
$registry->add(new SecurityExtension($xoopsSecurity, $xoopsGroupPermHandler));
$registry->registerAll($smarty); // works with both Smarty 4 and Smarty 5

(new TextExtension())->register($smarty);
smarty
<{generate_url route="modules/news/article.php" params=['id' => 42] assign="articleUrl"}>
<a href="<{$articleUrl|escape}>">Read more</a>
smarty
<{xo_permission logged_in=true >
<{/xo_permission}>
smarty
<{validate_form data=$_POST rules=['email' => ['
smarty
<{xo_get_config name="sitename" assign="siteName"}>
<title><{$siteName}></title>

<{"_MI_NEWS_LATEST_TITLE"|translate}>

src/
├── AbstractExtension.php       Base class — register(), getModifiers(), getFunctions(), getBlockHandlers()
├── ExtensionRegistry.php       Collects extensions, auto-detects Smarty 4/5, registers all
├── Adapter/
│   └── Smarty5Adapter.php      Wraps AbstractExtension for Smarty 5 addExtension() API
└── Extension/
    ├── TextExtension.php
    ├── FormatExtension.php
    ├── NavigationExtension.php
    ├── SecurityExtension.php
    ├── FormExtension.php
    ├── DataExtension.php
    ├── AssetExtension.php
    ├── XoopsCoreExtension.php
    └── RayDebugExtension.php