Jump to content

Module ne s'affiche pas sur un nouveau hook


Recommended Posts

Bonjour,

 

Je rencontre de la difficulté à afficher un module sur un nouveau hook.

 

Le hook à bien été créé dans ma base mysql et est bien visible en backoffice.

 

J'ai le code suivant dans l'overide : CategoryController.php

class CategoryController extends CategoryControllerCore
{
    /**
     * @see CategoryControllerCore::initContent()
     */
    public function initContent()
    {
        parent::initContent();

        $this->context->smarty->assign(
            'HOOK_SLIDER_TOP', Hook::exec('displaySliderTop')
        );
    }
}

Dans mon fichier Index.tpl avant TAB CONTENT j'ai :

<div class="test">
{if isset($HOOK_SLIDER_TOP)}{$HOOK_SLIDER_TOP}{/if}             
</div>

{if isset($HOOK_HOME_TAB_CONTENT) && $HOOK_HOME_TAB_CONTENT|trim}
.... 

Dans mon fichier.php du module slick j'ai :

public function install()
    {
         return (parent::install() && $this->registerHook('DisplaySliderTop') && $this->registerHook('home'));
    }

    public function uninstall()
    {
        return (parent::uninstall() && $this->unregisterHook('DisplaySliderTop') && $this->registerHook('home'));
    }
    
    
    
    public function hookDisplayHeader($params)
    {
        $this->context->controller->addCss($this->_path . 'slick.css', 'all');
        $this->context->controller->addCss($this->_path . 'slick-theme.css', 'all');
    }



    function hookDisplaySliderTop($params)
    {
        global $smarty;
        return $this->display(__FILE__, 'slickslider.tpl');
    }

Dans le Backoffice, j'ai bien bien la position displaySliderTop avec mon module Slick accroché.

 

Mais je ne vois rien en Front ?

 

Je ne vois pas ou est l'erreur...

 

Merci

 

Claire

Edited by Mashup (see edit history)
Link to comment
Share on other sites

'HOOK_SLIDER_TOP', Hook::exec('displaySliderTop')

 

pourquoi greffer un hook sur un hook ?

 

 

dans function hookDisplaySliderTop($params), supprime global $smarty; et met à la place echo 'XXX hookDisplaySliderTop'; comme ça tu verra déjà si ta fonction est utilisée ou non.

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...