3

可能重复:
如何将外部 JavaScript 或 CSS 文件添加到我们的 Tridion 页面?

我想将 .css 和 .js 文件添加到 Tridion 服务器。

我想在 TBB 中提及它们。

<link href="path/style.css" rel="stylesheet" type="text/css" />
<script src="path/script.js" type="text/javascript"></script>

我有一些问题:

  1. 我需要将它们直接放在 Tridion 服务器机器上吗?

  2. 我需要将它们作为虚拟目录添加到 IIS 中以引用它们吗?

在任何一种方式中,我都不确定如何给出“href”。

我正在使用 Dreamweaver TBB 和 SDL Tridion 2011 SP1。

我知道还有其他方法可以处理 .css 和脚本。

但我的要求需要他们直接添加到服务器中。

请分享您的建议。

4

1 回答 1

4

It all depends on where the files are on the local disk (which unfortunately you fail to mention in your question).

If you have the files on disk like this:

c:\
   inetpub
       wwwroot
           mywebsite
               index.html
               style.css
               script.js

And you have created a web site with its root at c:\inetpub\wwwroot\mywebste, then you can refer to style.css and script.js from within index.html as

<link href="style.css" rel="stylesheet" type="text/css" />
<script src="script.js" type="text/javascript"></script>

If however you created a web site with its root at c:\inetpub\wwwroot, you'd refer to the same files as:

<link href="mywebsite/style.css" rel="stylesheet" type="text/css" />
<script src="mywebsite/script.js" type="text/javascript"></script>

Either way, you will have to ensure that the files are placed onto the web server. You can either do that through Tridion or by placing them there manually.

If you want to publish the CSS and JavaScript files from Tridion, I suggest reading this question: How to add external JavaScript or CSS files to our Tridion page?

于 2012-08-06T11:11:18.057 回答