繁体   English   中英

Joomla 添加第 3 方组件

[英]Joomla add 3rd party component

我试图通过将所有文件从public复制到 Joomla 本地文件夹来将一个svelte应用程序包含到Joomla站点中,并且在 Joomla 中,我创建了一篇带有脚本的文章,其中包含此index.html

苗条的输出

+---public
|   |   favicon.png
|   |   index.html
|   |   output.doc
|   |   
|   \---build
|           bundle.css
|           bundle.css.map
|           bundle.js
|           bundle.js.map

用于包含 index.html 的 Joomla 脚本

{source}

<?php ini_set("include_path", "/var/www/vhosts/examplesite.com/httpdocs/files/forms/public"); ?>

<?php include 'index.html'; ?>

{/source}

在本地,当我从公众发布 index.html 时,一切正常,Joomla noop 中的 bun。 错误是 Joomla 无法从构建文件夹中找到文件,例如在index.html中包含bundle.css,如下所示:

<script defer src='./build/bundle.js'></script>

我预计bundle.js 的完整路径是:

https://www.examplesite.com/files/forms/public/bundle.js

但实际上,浏览器需要它来自

https://www.examplesite.com/bundle.js

因此,构建文件夹中所有文件的路径存在问题。 帮助 !!!

如果你这样做

<script defer src='./build/bundle.js'</script>

浏览器确实会尝试从您提到的位置获取它,这是因为./部分表示并使其成为绝对路径。

将您的标记更改为:

<script defer src='/build/bundle.js'</script>

让它搜索相对于当前位置的包文件。

暂无
暂无

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

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