21298 Posts in 5735 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 786 Views |
-
Accessing variables in templates

13 January 2011 at 5:29pm
Hi,
I have a question about accessing variables in templates.
If I have classes Foo & Barclass Foo extends Page
{
static $db = array(
'ContainedItem' => 'Bar'
);
}class Bar extends Page
{
static $db = array(
'MyDate' => 'Date'
);
}I would like to know how to get at MyDate from Foo.ss
... along the lines of<% if Bar %>
<% control Bar %>
???? <- Here I want to do a comparison with the current date (if CurrentDate < MyDate) unsure how to do that also.
<% end_control %>
<% end-if %>Any help you can offer would be greatly appreciated.
Regards,
Scott
-
Re: Accessing variables in templates

14 January 2011 at 3:44am
Hi Scott,
Firstly this would live inside the template section (but that is me being picky)...
how about this...
(note all untested)<% if ContainedItem %>
<% control ContainedItem %>
<% if MyDate > Now %>
MyDate ({$MyDate}) is large than current date ({$Now})
<% end_if %>
<% end_control %>
<% end_if %> -
Re: Accessing variables in templates

18 January 2011 at 12:45pm
Hi, and thank you so much for the response. I hadn't even scrolled down the Forums main page far enough to see the templates section ... heh. I'll move over there.
Regards,
Scott
| 786 Views | ||
|
Page:
1
|
Go to Top |


