View previous topic :: View next topic |
Author |
Message |
tavancini Smarty Rookie
Joined: 22 Apr 2003 Posts: 5 Location: Brazil
|
Posted: Tue Apr 22, 2003 2:23 pm Post subject: html_select_date (selected date feature hack) |
|
|
hi,
i did a simple hack in the html_select_date plugin that you can select a specific date, instead of the actual date, using a timestamp as a parameter.
if anyone want the hack, reply me.
or, if the smarty project like this feature, i will be really happy to help. : )
thanks! |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Apr 22, 2003 7:34 pm Post subject: |
|
|
No hack needed, use the time attribute. |
|
Back to top |
|
tavancini Smarty Rookie
Joined: 22 Apr 2003 Posts: 5 Location: Brazil
|
Posted: Tue Apr 22, 2003 7:51 pm Post subject: whooooo... |
|
|
no comments.
b000! |
|
Back to top |
|
ilir Smarty Rookie
Joined: 20 Apr 2003 Posts: 16 Location: NYC
|
Posted: Fri Apr 25, 2003 1:17 pm Post subject: |
|
|
Mhort,
I read that in the Doc, too, but how would I use $time to get a selection for Month/Day (Year optional) 14 days from today???
Thanks,
Ilir. _________________ The real problem is not whether machines think but whether men do.
- B. F. Skinner |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Apr 25, 2003 2:36 pm Post subject: |
|
|
{html_select_date time="+14 days"}
This isn't a Smarty-specific syntax btw, this takes anything parsible by strftime(), so see the PHP documentation for the details. |
|
Back to top |
|
machnhed1 Smarty Regular
Joined: 21 Apr 2003 Posts: 39 Location: Illinois
|
Posted: Wed May 19, 2004 7:49 pm Post subject: |
|
|
mohrt wrote: | {html_select_date time="+14 days"} |
This was a very useful post. Thank you. _________________ "Every operating system out there is about equal in the number of vulnerabilities reported. We all suck."
- Microsoft Senior Vice President Brian Valentine |
|
Back to top |
|
machnhed1 Smarty Regular
Joined: 21 Apr 2003 Posts: 39 Location: Illinois
|
Posted: Thu Aug 19, 2004 3:32 pm Post subject: |
|
|
mohrt wrote: | {html_select_date time="+14 days"}
This isn't a Smarty-specific syntax btw, this takes anything parsible by strftime(), so see the PHP documentation for the details. |
Is there any way to do this for the date command?
For example:
Code: | {$smarty.now|date_format:"%m" time="-30 days"} |
Or do I have to pass this value from the php file? _________________ "Every operating system out there is about equal in the number of vulnerabilities reported. We all suck."
- Microsoft Senior Vice President Brian Valentine |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Aug 19, 2004 3:36 pm Post subject: |
|
|
{"-30 days"|strtotime|date_format:"%m"} |
|
Back to top |
|
machnhed1 Smarty Regular
Joined: 21 Apr 2003 Posts: 39 Location: Illinois
|
Posted: Thu Aug 19, 2004 3:45 pm Post subject: |
|
|
mohrt,
Big thanks again, this was EXACTLY what I needed. Is there documentation that I am missing that explains how this is possible? Perhaps via PHP.net or something _________________ "Every operating system out there is about equal in the number of vulnerabilities reported. We all suck."
- Microsoft Senior Vice President Brian Valentine |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Thu Aug 19, 2004 4:59 pm Post subject: |
|
|
BTW: {"-30 days"|date_format:"%m"} should be enough. since date_format uses strtotime internally to convert "-30 days" to a timestamp. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Aug 19, 2004 6:28 pm Post subject: |
|
|
messju wrote: | BTW: {"-30 days"|date_format:"%m"} should be enough. since date_format uses strtotime internally to convert "-30 days" to a timestamp. |
Good catch, that is true. |
|
Back to top |
|
machnhed1 Smarty Regular
Joined: 21 Apr 2003 Posts: 39 Location: Illinois
|
Posted: Thu Aug 19, 2004 6:37 pm Post subject: |
|
|
messju wrote: | BTW: {"-30 days"|date_format:"%m"} should be enough. since date_format uses strtotime internally to convert "-30 days" to a timestamp. |
Indeed they both worked. Thanks to each of you; your're real assets to this forum. _________________ "Every operating system out there is about equal in the number of vulnerabilities reported. We all suck."
- Microsoft Senior Vice President Brian Valentine |
|
Back to top |
|
novus Smarty Rookie
Joined: 17 Nov 2003 Posts: 7
|
Posted: Tue Dec 28, 2004 3:53 pm Post subject: |
|
|
hi
the posts above were very useful but now i have another problem. i want to select the year 4 years ago. i did it with
{html_select_date prefix="dateFrom" time="-4 years" start_year="-4" display_days=false}
but this code wont work.
any idea? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Dec 28, 2004 3:58 pm Post subject: |
|
|
only the time attribute respects strtotime(), othewise you have to do it manually (or assign $start_year from PHP)
Code: | {html_select_date prefix="dateFrom" time="-4 years" start_year="-4 years"|date_format:"%Y" display_days=false} |
|
|
Back to top |
|
|