3

重複の可能性:
外部の JavaScript または CSS ファイルを Tridion ページに追加するには?

.css および .js ファイルを Tridion サーバーに追加したいと考えています。

TBBsでそれらを参照したい。

<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 に答える