You are here: RE: [SMARTY] date offset « Smarty Templates Posts « IT news, forums, messages
RE: [SMARTY] date offset

Posted by David Zόlke on 09/29/99 11:04

Hi Travis,

stuff like this really belongs into the business logic, not into the display
logic. The _way_ a date/time is shown is controlled by the display logic,
but not the _value_ of the date/time itself.

Cheers and a Happy New Year to you,

David


> -----Original Message-----
> From: Travis Low [mailto:travis@dawnstar.com]
> Sent: Saturday, January 01, 2005 7:29 AM
> To: smarty-general@lists.php.net
> Subject: [SMARTY] date offset
>
> Happy new year, everyone.
>
> I have a customer in Australia who uses a server in California. I'd like
> to
> give them a configurable offset value (plus or minus hours) that could be
> used
> to change the time they're seeing. I know I could muck with the time from
> within the application itself, but ultimately, I think it would be better
> if
> the end-user could set the value, so that (for example) users in different
> timezones can adjust the times to suit their locale. Here is a hack of
> modifier.date_format.php that seems to work:
>
> function smarty_modifier_date_format($string, $format="%b %e, %Y",
> $offset=0,
> $default_date=null)
> {
> echo "<h1>$offset</h1>";
> if($string != '') {
> return strftime($format, smarty_make_timestamp($string) +
> ($offset*3600));
> } elseif (isset($default_date) && $default_date != '') {
> return strftime($format, smarty_make_timestamp($default_date) +
> ($offset*3600));
> } else {
> return;
> }
> }
>
> Unfortunately, I couldn't get it to work without swapping $offset and
> $default_date, and I fear that may break existing code. Does anyone have
> any
> ideas, and could something like the above be included in the next Smarty
> release?
>
> cheers,
>
> Travis
>
> --
> Travis Low
> <mailto:travis@dawnstar.com>
> <http://www.dawnstar.com>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация