getherbie / plugin-googlemaps
Herbie 的 Google Maps 插件。
v1.0.0
2016-04-05 15:01 UTC
Requires
- getherbie/herbie: ^1.0.0
This package is auto-updated.
Last update: 2024-09-29 04:03:16 UTC
README
Google Maps 是一个 Herbie 插件,可以让你将 Google Maps 地图嵌入到你的网站中。
你可以指定一个地址,该地址将被地理编码并附上位置图标。更多功能正在计划中。
安装
你可以通过 Composer 安装此插件。
$ composer require getherbie/plugin-googlemaps
之后,请在配置文件中激活此插件。
plugins:
enable:
- googlemaps
配置
在 plugins.config.googlemaps 下,你可以使用以下选项
# template path to twig template
template: @plugin/googlemaps/templates/googlemaps.twig
# enable shortcode
shortcode: true
# enable twig function
twig: false
应用
安装后,你将可以使用 googlemaps 短代码。你可以这样调用它
[googlemaps id="gmap" width="600 height="450" type="roadmap" class="gmap" zoom="15" address="Baslerstrasse 8048 Zürich"]
如果你在配置中启用了 Twig 功能,你也可以在布局文件中使用同名的 Twig 函数。
{{ googlemaps("gmap", 600, 450, "roadmap", "gmap", 15, "Baslerstrasse 8048 Zürich") }}
你还可以使用命名参数调用此函数。
{{ googlemaps(address="Baslerstrasse 8048 Zürich", type="roadmap") }}