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

Allow nulls in html_select_date

 
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 -> Feature Requests
View previous topic :: View next topic  
Author Message
egarcia
Smarty n00b


Joined: 27 Jun 2003
Posts: 1
Location: Medellin, Colombia

PostPosted: Fri Jun 27, 2003 1:56 pm    Post subject: Allow nulls in html_select_date Reply with quote

Hello, I find very useful to be able to leave NULL a date. For it I have modified plugin's script.

There's two options:
1. Add the $allow_null parameter to the html_options, so change the smarty_function_html_options, or
2. Only change the html_select_date

With the first option, then we can change in cascade the others, only passing the $allow_null to the internal render function.

I'm showing the change if only you touch the html_select_date. The change is more easy and consistent in html_options, smarty_function_html_options and then in html_select_date.

In the default session, I add:
[php:1:695b4b9472]<?php
$allow_null = false;
?>[/php:1:695b4b9472]

After the extract params I add:
[php:1:695b4b9472]<?php
// support to the allow_null parameter
if (empty($time)) {
if ($allow_null) {
$time = '0000-00-00';
} else {
$time = time();
}
}
?>[/php:1:695b4b9472]

Before render the options in the month_result I add:
[php:1:695b4b9472]<?php
// if the allow_null is set then create a empty value
if ($allow_null) $month_result .= '<option></option>';
?>[/php:1:695b4b9472]

Before render the options in the day_result I add:
[php:1:695b4b9472]<?php
// if the allow_null is set then create a empty value
if ($allow_null) $day_result .= '<option></option>';
?>[/php:1:695b4b9472]

Before render the options in the year_result I add:
[php:1:695b4b9472]<?php
// if the allow_null is set then create a empty value
if ($allow_null) $year_result .= '<option></option>';
?>[/php:1:695b4b9472]

I hope that this change will be implemented.

Regards,
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
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 -> Feature Requests 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