Jump to content

Module disparaît avec le cache


Recommended Posts

Bonjour,

 

j'ai créé un module qui s'affiche dans la colonne de gauche de mon site. Ce module ne fait qu'afficher des images.

 

Sans cache, le module fonctionne correctement. Dès que le cache est activé, il disparaît.

 

D'où cela peut venir ?

 

Merci.

 

Florian.

Link to comment
Share on other sites

Voici le .tpl :

 

<div id="categories_block_left" class="block">
 <div class="block_content">
<ul>
	<a href="http://www.kelrobot.fr"><img src="http://www.boutique.kelrobot.fr/themes/andolo/img/cms/post_it.png" border="0" align="center"></img></a>
</ul>
 </div>
</div>
<table>
 <tr>
<td align="center">
   <img src="http://www.boutique.kelrobot.fr/themes/andolo/img/cms/transport.png" border="0" align="center" width=100 height=100%></img>	
</td>
 </tr>
 <tr>
<td align="right">
	<img src="http://www.boutique.kelrobot.fr/themes/andolo/img/cms/chronopost.png" border="0" align="center" width=75 height=100%></img>		
	<img src="http://www.boutique.kelrobot.fr/themes/andolo/img/cms/relais_colis.jpg" border="0" align="center" width=75 height=100%></img>		
	<img src="http://www.boutique.kelrobot.fr/themes/andolo/img/cms/Fed_ex.png" border="0" align="center" width=75 height=100%></img>		
</td>
 </tr>
</table>

 

Et voici le .php :

 

<?php
if (!defined('_PS_VERSION_'))
 exit;

class AForum extends Module{
 public function __construct(){
$this->name = 'AForum';
$this->tab = 'Test';
$this->version = 1.0;
$this->author = 'Flo';
$this->need_instance = 0;

parent::__construct();

$this->displayName = $this->l('AForum');
$this->description = $this->l('Permet de faire un lien vers le forum.');
}

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

public function hookRightColumn($params){
 if (!$this->isCached('AForum.tpl', $this->getCacheId()))

 return $this->display(__FILE__, 'AForum.tpl', $this->getCacheId());
}

public function hookLeftColumn($params){
 return $this->hookRightColumn($params);
}

public function hookHeader( $params){
Tools::addCSS(($this->_path).'css/AForum.css', 'all');
}

public function uninstall(){
if (!parent::uninstall())
  Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'AForum`');
parent::uninstall();
 }
}
?>

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

C'est une blague !?

 

Vous faites une condition sur l'affichage du fichier tpl, pas étonnant que ça ne s'affiche que si le cache est désactivé !

supprimez cette ligne et vous n'aurez plus de souci

if (!$this->isCached('AForum.tpl', $this->getCacheId()))

 

Franck

Link to comment
Share on other sites

Ça ne vient pas de ça. J'ai récupéré ce code via un tuto pour créer des modules (c'est mon 1er module).

Cette condition est présente pour le hook right column alors que je l'affiche sur le left column.

Link to comment
Share on other sites

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...