|
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 |
lan19 Smarty Rookie
Joined: 18 Mar 2011 Posts: 12
|
Posted: Sun Nov 11, 2012 12:10 pm Post subject: [Résolu]Afficher le temps de génération de la page |
|
|
Bonjour,
Je voudrais dans un footer.tpl, afficher le temps de génération de la page en seconde.
Comment peut-on faire cela ?
Last edited by lan19 on Sun Dec 30, 2012 9:51 am; edited 1 time in total |
|
Back to top |
|
bluejester Smarty Regular
Joined: 26 Apr 2012 Posts: 55
|
Posted: Mon Nov 12, 2012 9:50 am Post subject: |
|
|
Hello,
Si tu es sous PHP5 et Smarty 3 :
Dans ton fichier php (à placer en tout premier) :
Code: |
<?php
$_SERVER['REQUEST_MICROTIME_START'] = microtime(true);
|
Dans ton fichier footer.tpl :
Code: |
Page générée en {(microtime(true) - $smarty.server.REQUEST_MICROTIME_START)|round:3}s
|
|
|
Back to top |
|
lan19 Smarty Rookie
Joined: 18 Mar 2011 Posts: 12
|
Posted: Mon Nov 12, 2012 8:19 pm Post subject: |
|
|
Bonsoir,
Merci pour votre réponse.
Je suis sur 2.6.20 et php5 ! |
|
Back to top |
|
bluejester Smarty Regular
Joined: 26 Apr 2012 Posts: 55
|
Posted: Wed Nov 14, 2012 11:12 am Post subject: |
|
|
Si tu es sous PHP5, je t'encourage vivement à passer à Smarty 3 !
La syntaxe est plus simple, les templates se compilent plus vite, le système de cache est excellent, et l'héritage de templates est juste indispensable une fois qu'on y a goûté |
|
Back to top |
|
lan19 Smarty Rookie
Joined: 18 Mar 2011 Posts: 12
|
Posted: Wed Nov 14, 2012 12:25 pm Post subject: |
|
|
Bonjour,
Merci pour ces recommandations.
Je me penche sur le sujet car j'ai peur de tout casser en passant à smarty3.
Salutations |
|
Back to top |
|
bluejester Smarty Regular
Joined: 26 Apr 2012 Posts: 55
|
Posted: Wed Nov 14, 2012 4:37 pm Post subject: |
|
|
Oui, si tu as un gros site en prod il faut y aller à tâtons...
Le mieux est de se faire la main sur un projet from scratch afin d'être en confiance
C'est ce que j'ai fait de mon côté, et je ne le regrette pas !
J'ai trop du mal avec Smarty 2 maintenant |
|
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
|