fm:DateList provides a simple interface to list dates in a range of formats.
<fm:DateList interval="day" startDate="-30 days" dateFormat="D, M jS, Y">
<select>
<fm:Loop>
<option value="{$$date_year}-{$$date_month}-$$date_day}">{$$date}</option>
</fm:Loop>
</select>
</fm:DateList>
This example will output a dropdown input field containing the past 30 days:
Name | Required | Default | Description |
---|---|---|---|
dateFormat | Optional | None | Date format. This controls the value of the "date" template variable within the fm:DateList loop. This must be in a format accepted by PHP's date function. If this is not set then the "date" template variable will not be available. |
endDate | Optional | Current date and time | End of range, exclusive. This must be in a format accepted by PHP's date function. |
evenClass | Optional | The contents of this attribute will be placed in the 'loop.evenClass' template variable, only for even row-numbers. This allows you to give every even row a specific css class | |
interval | Optional | day | Increment interval. This must be one of "day", "month", or "year". Note that this is case sensitive. |
oddClass | Optional | The contents of this attribute will be placed in the 'loop.oddClass' template variable, only for odd row-numbers. This allows you to give every odd row a specific css class | |
startDate | Optional | January 1st, 2005 | Start of range, inclusive. This must be in a format accepted by PHP's date function. |
Name | Description |
---|---|
loop.hasResults | The contents of this variable will be either 0 or 1, depending on if there are items in the list. |
loop.oddClass | The contents of this variable will reflect the "oddClass" attribute. This will only be set for odd rownumbers. |
loop.evenClass | The contents of this variable will reflect the "evenClass" attribute. This will only be set for even rownumbers. |
loop.index | The 0-based index of the item in the loop. (Will contain 0,1,2,3,4, etc.) |
loop.count | The count of the current item in the loop. (Will contain 1,2,3,4,5 etc.) |
loop.currentPage | If a pager is involved in this loop, this will contain the current page number (0-based index). If page information is not available, this will be 0. |
loop.currentPage1 | This value is currentPage + 1. This number can be useful to display the current page number to use user. (people generally count from 1, not 0). |
loop.totalPages | Total number of pages avaiable in this loop. This will be 0 if the loop does not support paging. |
loop.totalItems | Total number of individual items. This will be 0 if the loop does not support paging. |
loop.pageSize | Total number of items on 1 single page. This will be 0 if the loop does not support paging. |
date | The current iteration's date, formatted according to the attribute "dateFormat". If "dateFormat" is not set then this template variable is not available. |
date_year | The current iteration's year as a four digit number. |
date_month | The current iteration's month as a one or two digit number. |
date_day | The current iteration's day as a one or two digit number. |
date_timestamp | The current iteration's Unix timestamp. Note that if you use a relative value for "startDate" (eg: "-30 days") then the timestamp will likely not fall exactly at the transition (midnight) between days. |