Page 1 of 1

url conventions and date calculations

PostPosted: Thu Sep 13, 2012 1:22 pm
by shardison
Steve,
I want to thank you for answering my previous questions. Now I have a new question.

I have the following list element in my dashboard:

<li>
<img src="{$ENV.DATAFACE_URL}/images/edit.gif"/>
<a href="{$ENV.DATAFACE_SITE_HREF}?-table=visits&need_interview==1&interviewer==&
date_of_visit=={$mydate} &-action=list">List waiting for interviews:</a>
</li>


I want to filter for date_of_visit == TODAYS_DATE; I was thinking I could make a function in my dashboard.php file called mydate(). But I cant seem to get the implementation for my dashboard.html. I know that {......} represents a call to functions in other files but am missing exactly how the mechanics work. Anyway my main request is to be able to filter my visits table to just visits for today

Re: url conventions and date calculations

PostPosted: Thu Sep 13, 2012 1:35 pm
by shannah
You can only access variables in a template that you pass to its context. E.g. To add a variable $mydate to your template's context, you need to add it in the array() that you pass as the first parameter to df_display().

Code: Select all
df_display(array('mydate' => '2012-12-01'), 'path/to/mytemplate.html');


In this case, you also might want to look at the smarty.now and smarty dateformat functions.

http://www.smarty.net/docsv2/en/languag ... ate.format