|
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 |
Fria Smarty n00b
Joined: 24 Sep 2015 Posts: 1
|
Posted: Thu Sep 24, 2015 1:46 pm Post subject: Global counter or random var |
|
|
Hello,
I'm building a small reservation system for a product. When the form is submitted an email is sent to the user that he has successfully reserved a copy.
I would like to include in this email a unique reservation order, lets say from 1 to 999.
The form is processed through one .tpl file in which there is an include for 2 other .tpl files: one with email subject and one with email content.
I'd like to put a counter on every reservation and send it in the email content.
Is there a global counter of some sort? Or perhaps there's an easier way to do this?
Kind regards!
EDIT: I know that counter is global, but Im not sure how to use it in this case |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu Sep 24, 2015 6:51 pm Post subject: |
|
|
The {counter} is global between main template and it's subtemplate. It's not global between page calls.
You can use also in your template the PHP function uniqid() to get a unique number.
See http://php.net/manual/en/function.uniqid.php |
|
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
|