3063 Posts in 864 Topics by 646 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1896 Views |
-
$Expires.InPast is not working.

26 April 2009 at 9:51am Last edited: 26 April 2009 7:26pm
I'm new to Silverstripe and realy start to like it!. But I think there is a bug.
The Expires.InPast seems to be not working correctly. It makes no sense to me! Can someone help me?Please, take a look at this code and the output:
Code:
-------<% if Expires.InPast %>
<h3>THE DATE HAS EXPIRED!</h3>
<p><i>Today is $Now.</i></p>
<p>Expiringdate is $Expires.</p>
<p>Expiringdate has expired $Expires.Ago.</p>
<% else %>
<h3>Not yet Expired</h3>
<p>Expiringdate will be $Expires.</p>
<% end_if %>
output:
-------THE DATE HAS EXPIRED!
Today is 2009-04-25.
Expiringdate is 2009-05-20.
Expiringdate has expired 24 days away.
-------
I'm using SilverStripe-v2.3.1.
What is wrong? -
Re: $Expires.InPast is not working.

13 May 2009 at 2:02am
is this line...
<% if Expires.InPast %>
missing a dollar sign for the variable?
<% if $Expires.InPast %>
I am also having issues with the InPast function in 2.2.1 ... I get a missing { php error, and can't seem to track it down.
-
Re: $Expires.InPast is not working.

17 May 2009 at 9:56am
Hi RS26,
The $ sign should not be there. You get an error if it is there.
But even if you do not put it ther, it will not work properly, I think.Regards!
-
Re: $Expires.InPast is not working.

19 May 2009 at 5:17am Last edited: 19 May 2009 5:19am
What I by now figured out was, that the problem possibly lies in the rendering of the template.
Everything works fine and the Funktion returns the right value. in that case false or 0I tried to put out something like
+Date.InPast+ in the .ss File and the output is ++
so the return value must be 0but the following expression turns true
<% if Date.InPast %>
-
Re: $Expires.InPast is not working.

21 November 2012 at 6:48am Last edited: 21 November 2012 6:48am
I realise this is old and may be fixed in SS3 but I'm adding something to a 2.4.5 site that I can't really be bothered to convert to SS3...
What are we meant to do, just use <% if Date.InFuture %><% else %>? That seems a bit silly. It works, granted, but surely there must be a neater way?
-
Re: $Expires.InPast is not working.

27 November 2012 at 12:10pm Last edited: 27 November 2012 12:13pm
FWIW inFuture didn't actually work either so went with stealing and modifying the simple function suggested here: http://www.silverstripe.org/data-model-questions/show/9491 so that I always got back something True, as null obviously wasn't False enough.
| 1896 Views | ||
|
Page:
1
|
Go to Top |



