rainlab / weather-plugin
October CMS 的天气插件
dev-master
2016-07-16 06:39 UTC
Requires
- php: >=5.5.9
- composer/installers: ~1.0
This package is auto-updated.
Last update: 2024-09-15 06:50:29 UTC
README
此插件是为 php[tek] 2014 会议创建的。
天气信息从 Open Weather Map 加载。为了简单起见,检查器下拉菜单中的国家列表限制为美国、加拿大和澳大利亚,但如果你手动编辑页面代码中的组件定义,你可以设置任何国家和州。
此插件定义了一个具有四个属性的天气组件
- country - 两位国家代码,默认值是 "us"
- state - 两位州代码,默认值是 "dc"
- city - 城市名称,默认值是 "Washington"
- units - 温度和风速的单位,可能的值是 "metric" 和 "imperial",默认值是 "imperial"。
要使用该组件,将其拖放到页面上,并在页面代码的任何位置使用 {% component 'weather' %}
标签来渲染它。请注意,组件向页面注入一个 CSS 文件引用以对控件进行样式设置。这是可选的。如果你想使用它,请在 HEAD 部分使用 {% styles %}
标签。以下是一个使用天气组件的最简单页面代码示例
title = "Weather"
url = "/weather"
[weather]
units = "metric"
==
<!DOCTYPE html>
<html>
<head>
<title>Weather component example</title>
{% styles %}
</head>
<body>
{% component 'weather' %}
</body>
</html>