Difference between revisions of "Template:Calendar Event List"

From Open Energy Information

(Adding min and max to view all output)
(Moved showing x of y to top. Changed viewall variable to required.)
Line 26: Line 26:
 
|<!-- result is empty --><p class="h5 text-muted text-center">No events found.</p>
 
|<!-- result is empty --><p class="h5 text-muted text-center">No events found.</p>
 
|<!-- the array is not empty, loop through it -->
 
|<!-- the array is not empty, loop through it -->
{{#if: {{{title|}}} | <h3 class="text-center" style="padding:0 0 8px 0;">[[:{{{viewall|}}}|{{{title}}}]]</h3>}}
+
{{#if: {{{title|}}} | <h3 class="text-center" style="padding:0 0 8px 0;">[[:{{{viewall}}}|{{{title}}}]]</h3>}}
 +
{{#if: {{{viewall|}}} | <div class="text-center">Showing {{#time: M j, Y | {{#var:datemin}} }} to {{#time: M j, Y | {{#var:datemax}} }} [[:{{{viewall}}}|View All]]</div>}}
 
{{#arrayprint:eventList||@@|{{#arraydefine:split.eventList|@@|<PROP>|}}
 
{{#arrayprint:eventList||@@|{{#arraydefine:split.eventList|@@|<PROP>|}}
 
{{#ifexpr: ({{#time: U | {{#arrayindex:split.eventList|3}} }} >= {{#time: U | {{#var:datemin}} }}) and ({{#time: U | {{#arrayindex:split.eventList|3}} }} <= {{#time: U | {{#var:datemax}} }}) |
 
{{#ifexpr: ({{#time: U | {{#arrayindex:split.eventList|3}} }} >= {{#time: U | {{#var:datemin}} }}) and ({{#time: U | {{#arrayindex:split.eventList|3}} }} <= {{#time: U | {{#var:datemax}} }}) |
Line 40: Line 41:
 
}}
 
}}
 
|}}
 
|}}
{{#if: {{{viewall|}}} | <div class="text-center">Showing {{#time: M j, Y | {{#var:datemin}} }} - {{#time: M j, Y | {{#var:datemax}} }} [[:{{{viewall|}}}|View All Events]]</div>}}
+
{{#if: {{{viewall|}}} | <div class="text-center">[[:{{{viewall}}}|View All Events]]</div>}}
 
}}
 
}}
 
</div>
 
</div>
 
</includeonly>
 
</includeonly>

Revision as of 08:19, 27 March 2019

This is the Calendar Event List template. It is designed for use by Events.

Parameters
  • tags - The tags to search for.
  • datemin - The min date to display (in php strtotime format, e.g. "-2 days", "-1 week").
  • datemax - The max date to display (in php strtotime format).
  • limit - The limit of items to show
  • viewall - Name of view all page
  • title - Title to display
Dependencies
  • Designed for use in a parent form, such as Form:Event.
Usage

It should be invoked using a parent form.