Difference between revisions of "Template:Calendar Event List"

From Open Energy Information

(adding min and max to view all)
m (Reverted edits by Avimont (talk) to last revision by Tomking)
Line 8: Line 8:
 
* '''limit''' - The limit of items to show
 
* '''limit''' - The limit of items to show
 
* '''viewall''' - Name of view all page
 
* '''viewall''' - Name of view all page
 +
* '''title''' - Title to display
  
 
=====Dependencies=====
 
=====Dependencies=====
Line 25: 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: {{{viewall|}}} | <div class="text-center" style="margin: 0 0 20px 0;">[[:{{{viewall|}}}|View All Events]]</div>}}
+
{{#if: {{{title|}}} | <h3 class="text-center" style="padding:0 0 8px 0;">[[:{{{viewall|}}}|{{{title}}}]]</h3>}}
 
{{#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}} }}) |
<div class="calendar-event"
+
<div class="calendar-event">
data-startdate="{{#time: U | {{#arrayindex:split.eventList|3}}}}"
 
data-enddate="{{#time: U | {{#arrayindex:split.eventList|4}} }}"
 
data-eventname="{{#arrayindex:split.eventList|1}}"
 
data-eventlocation="{{#arrayindex:split.eventList|5}}"
 
>
 
 
<div class="calendar-event-date-pretty"><span class="pretty-date-month">{{#time:M|{{#arrayindex:split.eventList|3}}}}</span><br><span class="pretty-date-day">{{#time:j|{{#arrayindex:split.eventList|3}}}}</span></div>
 
<div class="calendar-event-date-pretty"><span class="pretty-date-month">{{#time:M|{{#arrayindex:split.eventList|3}}}}</span><br><span class="pretty-date-day">{{#time:j|{{#arrayindex:split.eventList|3}}}}</span></div>
 
<div class="calendar-event-details">
 
<div class="calendar-event-details">
Line 44: Line 40:
 
}}
 
}}
 
|}}
 
|}}
{{#if: {{{viewall|}}} | <div class="text-center">Showing {{#time: M j, Y | {{#var:datemin}} }} - {{#time: M j, Y | {{#var:datemax}} }} [[:{{{viewall|}}}|View All]]</div>}}
+
{{#if: {{{viewall|}}} | <div class="text-center">[[:{{{viewall|}}}|View All Events]]</div>}}
 
}}
 
}}
 
</div>
 
</div>
 
</includeonly>
 
</includeonly>

Revision as of 13:09, 21 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.