简体   繁体   English

Drupal-使用框架显示自定义php / javascript?

[英]Drupal - Using a frame to display custom php / javascript?

I've created a custom file for a google-maps that uses javascript, php, and SQL statements. 我已经为使用javascript,php和SQL语句的google-maps创建了一个自定义文件。 Instead of building a module, is it possible to just simply create a frame for page--front.tpl.php to display my file for the google map? 除了构建模块以外,是否可以仅为page--front.tpl.php创建框架以显示我的Google Map文件?

Basic implementation of the iframe would be: iframe的基本实现为:

<iframe src="/map_script.php" width="300" height="300"></iframe>

Where map_script.php would be your custom map file and you would place it in the root of your website. 其中map_script.php将是您的自定义地图文件,并将其放置在网站的根目录中。

If you didn't want the file in the root of your website but in your theme instead it would be: 如果您不希望该文件出现在网站的根目录中,而是想要显示在主题中,则应为:

<iframe src="/sites/all/themes/theme_name/map_script.php" width="300" height="300"></iframe>

Changing the path to suit your site's file structure and theme name. 更改路径以适合您站点的文件结构和主题名称。

Of course you can change the width and height or play around with any of the iframe attributes. 当然,您可以更改宽度和高度或使用任何iframe属性进行操作。 For more information on what you can do with the iframe tag see https://developer.mozilla.org/en/docs/Web/HTML/Element/iframe 有关您可以使用iframe标记执行的操作的更多信息,请参见https://developer.mozilla.org/en/docs/Web/HTML/Element/iframe

You can put that iframe tag wherever you want the map to print in your page--front.tpl.php file. 您可以将iframe标记放在要在页面上打印地图的任何位置-front.tpl.php文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM