Creatinging initial version of weather plugin
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php namespace JasonWilliams\CalgaryConditions\Components;
|
||||
|
||||
use Cms\Classes\ComponentBase;
|
||||
use ApplicationException;
|
||||
|
||||
class CurrentInfo extends ComponentBase
|
||||
{
|
||||
public $fields;
|
||||
|
||||
public function componentDetails()
|
||||
{
|
||||
return [
|
||||
'name' => 'Current Info',
|
||||
'description' => 'Displays the current weather and time in Calgary, AB, Canada'
|
||||
];
|
||||
}
|
||||
|
||||
public function onRun()
|
||||
{
|
||||
date_default_timezone_set('America/Edmonton');
|
||||
$this->fields['time'] = date('g:ia');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{% set conditions = __SELF__.fields %}
|
||||
|
||||
<p>Right now in Calgary the time is {{ conditions.time }}</p>
|
||||
Reference in New Issue
Block a user