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

[Résolu]Afficher le temps de génération de la page

 
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
lan19
Smarty Rookie


Joined: 18 Mar 2011
Posts: 12

PostPosted: Sun Nov 11, 2012 12:10 pm    Post subject: [Résolu]Afficher le temps de génération de la page Reply with quote

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
View user's profile Send private message
bluejester
Smarty Regular


Joined: 26 Apr 2012
Posts: 55

PostPosted: Mon Nov 12, 2012 9:50 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
lan19
Smarty Rookie


Joined: 18 Mar 2011
Posts: 12

PostPosted: Mon Nov 12, 2012 8:19 pm    Post subject: Reply with quote

Bonsoir,
Merci pour votre réponse.

Je suis sur 2.6.20 et php5 !
Back to top
View user's profile Send private message
bluejester
Smarty Regular


Joined: 26 Apr 2012
Posts: 55

PostPosted: Wed Nov 14, 2012 11:12 am    Post subject: Reply with quote

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é Smile
Back to top
View user's profile Send private message Visit poster's website
lan19
Smarty Rookie


Joined: 18 Mar 2011
Posts: 12

PostPosted: Wed Nov 14, 2012 12:25 pm    Post subject: Reply with quote

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
View user's profile Send private message
bluejester
Smarty Regular


Joined: 26 Apr 2012
Posts: 55

PostPosted: Wed Nov 14, 2012 4:37 pm    Post subject: Reply with quote

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 Smile

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 Cool
Back to top
View user's profile Send private message Visit poster's website
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