Typo3一页使用PIDinRootline的特殊javascript或css

时间:2012-11-29 18:51:15

标签: typo3

我希望一个页面有更多javascript包含然后是正常的。 我用了这段代码:

    page=PAGE
page{
headerData{
5=TEXT
5.value=<linkhref="fileadmin/templates/style.css"rel="stylesheet"type="text/css"/>
10=TEXT
10.value=<linkhref="http://fonts.googleapis.com/css?family=Cabin+Sketch:bold"rel="stylesheet"type="text/css"/>
20=TEXT
20.value=<scriptsrc="http://code.jquery.com/jquery-latest.js"type="text/javascript"></script>
40=TEXT
40.value=<scripttype="text/javascript"src="fileadmin/templates/js/easySlider1.7.js"></script>
50=TEXT
50.value=<scripttype="text/javascript">$(document).ready(function(){$("#slider").easySlider({auto:true,continuous:true,prevId:'prevBtn',prevText:'',nextId:'nextBtn',nextText:'',speed:1000,pause:20000,});});</script>
**[PIDinRootline = 8]**
60=TEXT
60.value=<linkhref="fileadmin/templates/skills/default.css"rel="stylesheet"type="text/css"/>
70=TEXT
70.value=<scriptsrc="fileadmin/templates/skills/raphael.js"type="text/javascript"></script>
80=TEXT
80.value=<scriptsrc="fileadmin/templates/skills/init.js"type="text/javascript"></script>
**[end]**
}

但这三个都包含在每一页中!

THX

3 个答案:

答案 0 :(得分:1)

条件不能嵌套在任何块中,所以改为:

page=PAGE
page{
  headerData{
     5=TEXT
     //...
     [PIDinRootline = 8]
       60=TEXT
     [end]
  }
}

您应该像这样使用它:

page=PAGE
page{
  headerData{
     5=TEXT
     //...
  }
}

[PIDinRootline = 8]
    page.headerData.60=TEXT
[end]

当然我假设您的样本**[PIDinRootline = 8]** - **[end]**中的星号是偶然的 - 它们是不允许的

答案 1 :(得分:1)

试试这个:

[globalVar = TSFE:id =8]
  page.headerData.60 = TEXT
  page.headerData.60.value (
    <link href="fileadmin/templates/skills/default.css" rel="stylesheet" type="text/css" />
    <script src="fileadmin/templates/skills/raphael.js" type="text/javascript"></script>
    <script src="fileadmin/templates/skills/init.js" type="text/javascript"></script>
)
[global]

甚至更好:

[globalVar = TSFE:id =8]
    page.includeCSS.fonts81 = fileadmin/templates/skills/default.css
    page.includeJS {
        file81 = fileadmin/templates/skills/raphael.js
        file81.type = application/x-javascript
        file82 = fileadmin/templates/skills/init.js
        file82.type = application/x-javascript

    }
[global]

答案 2 :(得分:0)

[PIDinRootline=8]
      page.headerData.60 = TEXT
      page.headerData.60.value = <link href="fileadmin/templates/skills/default.css" rel="stylesheet" type="text/css" />
      page.headerData.70 = TEXT
      page.headerData.70.value = <script src="fileadmin/templates/skills/raphael.js" type="text/javascript"></script>
      page.headerData.80 = TEXT
      page.headerData.80.value = <script src="fileadmin/templates/skills/init.js" type="text/javascript"></script>
[END]

Thx