|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
tharumm Smarty n00b
Joined: 13 Sep 2015 Posts: 1
|
Posted: Sun Sep 13, 2015 9:58 am Post subject: Template dans un plugin |
|
|
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
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 |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sun Sep 13, 2015 9:54 pm Post subject: |
|
|
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 |
|
|
|
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
|