THELIA Forum

Welcome to the THELIA support and discusssion forum

Announcement

Rejoignez la communauté sur le Discord Thelia : https://discord.gg/YgwpYEE3y3

Offline

#1 Création d'un plugin Smarty

(03-10-2014 09:05:00)


Bonjour,

Je souhaite créer un plugin Smarty. J'ai crée l'arborescence suivante:
http://imgur.com/NPJLLDA

Contenu du fichier config.xml

    <services>
        <service id="smarty.plugin.niceurl" class="Tools\Smarty\Plugin\Niceurl">
            <tag name="thelia.parser.register_plugin"/>
        </service>
    </services>

Contenu (partiel) du fichier Tools/Smarty/Plugin

namespace Tools\Smarty\Plugin;

use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;

/**
 * Class NiceUrl
 */
class NiceUrl extends AbstractSmartyPlugin
{

Contenu du fichier Tools/Tools.php

namespace Tools;

use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Install\Database;
use Thelia\Module\BaseModule;

class Tools extends BaseModule
{
    /*
    * Install the om_news table
    *

A l'activation du plugin j'obtiens le message d'erreur suivant:

FatalErrorException: Error: Class 'Tools\Smarty\Plugin\Niceurl' not found in /var/vhosts/scoot-company/cache/dev/CoreDevDebugProjectContainer.php line 1099

Mon Thelia est sous Debian 6.0.10, PHP 5.4.33

Offline


Tu as un problème de casse dans config.xml

<service id="smarty.plugin.niceurl" class="Tools\Smarty\Plugin\Niceurl">


OpenStudio Toulouse

Offline


Rahhhh, j'ai honte !!! J'ai passé 1/2 heure à m'arracher le peu de cheveux qu'il me reste sur la tête :-/

Merci Roadster

Offline


Un œil neuf, tout ça...


OpenStudio Toulouse