Drupal 7 iframe with .html file located inside theme
Drupal 7 iframe with .html file located inside theme
我有一个主题,其中包含一个名为 "user_news" 的文件夹。该文件夹位于 my_theme/user_news。在该文件夹中,我有一个 index.html 文件,我想将其加载到我的 Drupal 7 站点的 iframe 中。
我试过这个:
<iframe src="<?=variable_get("portal_link", NULL);?>/my_theme/user_news/index.html" width="600px" heigh="500px"></iframe>
iframe 位于我网站的首页。但是总是显示404页面。
任何可能导致此问题的想法。
即使我复制完整的 link 并将其放在浏览器的 url 栏中,它也会显示 404(即:https://portal_link/my_theme/user_news/index.html)。
例如,当我对 css 文件 (https://portal_link/my_theme/user_news/css/main.css) 执行相同操作时,它加载得非常好。
您无法直接从浏览器中的主题访问任何 index.html。您需要为此创建一个菜单。 Css 文件可以直接加载,因为它们被排除在 htaccess 文件中。
您可以在目标文件夹中创建一个新的.htaccess 文件,例如folder1/.htaccess
添加行
DirectoryIndex index.php index.html index.htm
Options +Indexes
现在可以从那里提供 index.htm 和 .html 文件。
如果这不起作用,请尝试在 Drupals .htaccess 文件中向该文件夹添加例外。在这里查看:https://www.drupal.org/node/30334
我有一个主题,其中包含一个名为 "user_news" 的文件夹。该文件夹位于 my_theme/user_news。在该文件夹中,我有一个 index.html 文件,我想将其加载到我的 Drupal 7 站点的 iframe 中。
我试过这个:
<iframe src="<?=variable_get("portal_link", NULL);?>/my_theme/user_news/index.html" width="600px" heigh="500px"></iframe>
iframe 位于我网站的首页。但是总是显示404页面。
任何可能导致此问题的想法。 即使我复制完整的 link 并将其放在浏览器的 url 栏中,它也会显示 404(即:https://portal_link/my_theme/user_news/index.html)。 例如,当我对 css 文件 (https://portal_link/my_theme/user_news/css/main.css) 执行相同操作时,它加载得非常好。
您无法直接从浏览器中的主题访问任何 index.html。您需要为此创建一个菜单。 Css 文件可以直接加载,因为它们被排除在 htaccess 文件中。
您可以在目标文件夹中创建一个新的.htaccess 文件,例如folder1/.htaccess 添加行
DirectoryIndex index.php index.html index.htm
Options +Indexes
现在可以从那里提供 index.htm 和 .html 文件。
如果这不起作用,请尝试在 Drupals .htaccess 文件中向该文件夹添加例外。在这里查看:https://www.drupal.org/node/30334