Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

$Date.RangeString question

Go to End



Community Member, 13 Posts

10 September 2008 at 11:34am


How is $Date.RangeString envisaged to work?

If I put:

$StartDate.RangeString( EndDate )

in a template. The error:

Fatal error: Call to a member function DayOfMonth() on a non-object .../sapphire/core/model/fieldtypes/Date.php on line 87

Occurs. This is because what is passed into RangeString is simply the string 'EndDate'. If I put:

$StartDate.RangeString( $EndDate )

in a template. The error:

Parse error: syntax error, unexpected T_STRING, expecting ')'

is raised from the cache. A quick look there shows:

$val .= $item->obj("StartDate")->XML_val("RangeString",array("
$val .= $item->XML_val("EndDate",null,true) ;
$val .= <<<SSVIEWER
"),true) ;
$val .= <<<SSVIEWER

Which I am guessing is a bit of a wrong 'un. Is this an issue with the template parser?

Any thoughts would be appreciated.