如何在 smarty 中显示谷歌地图代码
<div>
{$google_map_link}
</div>
我将以下谷歌地图 iframe 代码分配给 smarty 并尝试在屏幕上显示地图。
分配给 smarty 变量 {$google_map_link}
的 google 地图是
<iframe width="300" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.co.in/maps?q=Tiriyos&gl=in&hl=en&sll=13.008237,80.193329&sspn=0.206059,0.363579&ie=UTF8&view=map&cid=5721197682818793762&hq=Tiriyos&hnear=&ll=12.948405,80.137217&spn=0.006441,0.011362&iwloc=A&output=embed"></iframe>
<br />
<small>
<a href="http://maps.google.co.in/maps?q=Tiriyos&gl=in&hl=en&sll=13.008237,80.193329&sspn=0.206059,0.363579&ie=UTF8&view=map&cid=5721197682818793762&hq=Tiriyos&hnear=&ll=12.948405,80.137217&spn=0.006441,0.011362&z=17" style="color:#0000FF;text-align:left">View Larger Map</a>
</small>
我希望在屏幕上显示 google 地图,但只显示 iframe 代码
如何解决这个...
<div>
{$google_map_link}
</div>
I am assigning the following google map iframe codes into smarty and trying to display map on the screen.
google map that assigned to smarty variable {$google_map_link}
is
<iframe width="300" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.co.in/maps?q=Tiriyos&gl=in&hl=en&sll=13.008237,80.193329&sspn=0.206059,0.363579&ie=UTF8&view=map&cid=5721197682818793762&hq=Tiriyos&hnear=&ll=12.948405,80.137217&spn=0.006441,0.011362&iwloc=A&output=embed"></iframe>
<br />
<small>
<a href="http://maps.google.co.in/maps?q=Tiriyos&gl=in&hl=en&sll=13.008237,80.193329&sspn=0.206059,0.363579&ie=UTF8&view=map&cid=5721197682818793762&hq=Tiriyos&hnear=&ll=12.948405,80.137217&spn=0.006441,0.011362&z=17" style="color:#0000FF;text-align:left">View Larger Map</a>
</small>
I expect to display the google map on screen but only iframe codes are displayed
How to solve this...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我已经尝试过你的代码,它可以在 Smarty 3.0.8 上运行。
为什么不使用 Google 地图 API (http://code.google.com/apis/maps/index.html)?
我通常将 html 放入模板中并只传递值。示例如下:
php:
template:
然后您可以将信息窗口放在标记上。请在此处了解详情:http://code.google.com/apis /maps/documentation/javascript/overlays.html#InfoWindows
I've tried your code and it works on Smarty 3.0.8.
Why don't you use Google maps API (http://code.google.com/apis/maps/index.html)?
I usualy put html into the template and just pass the values. Example below:
php:
template:
Then you can put your info window on your marker. Read more here: http://code.google.com/apis/maps/documentation/javascript/overlays.html#InfoWindows
在 php
在 HTML
中,我使用
html_entity_decode
来解码谷歌地图 iframe 代码并在 smarty 中显示。这是在 smarty 中显示谷歌地图的最简单方法。我可以帮助别人
In php
In HTML
I had used
html_entity_decode
to decode google maps iframe code and displayed in smarty. This is easiest way to display google maps in smarty.I may help some one else