Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Template dans un plugin

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: French
View previous topic :: View next topic  
Author Message
tharumm
Smarty n00b


Joined: 13 Sep 2015
Posts: 1

PostPosted: Sun Sep 13, 2015 9:58 am    Post subject: Template dans un plugin Reply with quote

Bonjour, je me heurte à un problème et j'ai eu beau chercher sur google une solution rien y fait

Code:

/*
 * Smarty plugin
 * -------------------------------------------------------------
 * Fichier :  function.moncaroussel.php
 * Type :     fonction
 * Nom :      moncaroussel
 * Rôle :     retourne le caroussel
 * -------------------------------------------------------------
 */
function smarty_function_moncaroussel($params, &$smarty)
{

   $tpl = $smarty->fetch('moncaroussel/templates/index.tpl');
     return $tpl;

}


lorsque dans mon layout parent j'appelle
Code:

{moncaroussel}


j'obtiens une erreur
Code:

PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 16384 bytes) in /mnt/webp/a1/43/52038443/htdocs/claire/web/tools/smarty/sysplugins/smarty_internal_template.php on line 367


alors que si j'appelle le template directement en l'incluant dans le parent, il n'y a pas d'erreur
Code:

{include file="moncaroussel/templates/index.tpl"}


J'en viens à me demander si on peut faire un fetch ou un dispay dans un plugin.

Avez-vous une idée?

Merci de votre aide
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Sun Sep 13, 2015 9:54 pm    Post subject: Reply with quote

That's a weird and very resource intensive (as you've discovered) way to include a template.
Do it directly via {include} without weird wrappers.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: French All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP