【问题标题】:TYPO3 6.2 - rlmp_tmplselector & automaketemplate confusionTYPO3 6.2 - rlmp_tmplselector & automaketemplate 混淆
【发布时间】:2016-11-30 15:46:25
【问题描述】:

在将我的 TYPO3 从 4.5 升级到 6.2 后,我在内容页面上看到了一个空白的正文标签。我没有 php 错误,TYPO3 日志也是空的。

经过一些(几天)的尝试和错误,我得出的结论是模板有问题。

我的网站正在使用 automaketemplate 和 rlmp_tmpselector。起初,我没有找到兼容 TYPO3 6.2 的 rlmp_tmplselector 版本。因此,我尝试在ts_default.ts 中对 HTML 文件进行硬编码。

之后,页面有正确的(主)模板,菜单完全填满。但是没有内容,而是有一个“空”的主模板。

rlmp_tmpselector 的那个已经被使用了。我在 git 上找到了一个新版本,并安装了它。自述文件显示了一些语法更改:

rlmp_tmplselector
=================

## Änderungen im Typoscript

In dieser Version gibt es ein paar Änderungen im Typoscript:  

Bisher: (object) < plugin.tx_rlmptmplselector_pi1  
Jetzt: (object) < tt_content.list.20.rlmptmplselector_templateselector  

Bisher: plugin.tx_rlmptmplselector_pi1.templatePathMain =  
Jetzt: tt_content.list.20.rlmptmplselector_templateselector.settings.templatePathMain =   

Bisher: plugin.tx_rlmptmplselector_pi1.templatePathSub =  
Jetzt: tt_content.list.20.rlmptmplselector_templateselector.settings.templatePathSub =   

Bisher: template.templateType = sub
Jetzt: template.settings.templateType = sub

Bisher: template.templateType = main
Jetzt: template.settings.templateType = main

## Änderungen im TSconfig

ggf. folgende Zeilen im PageTSconfig auskommentieren

// TCEFORM.pages.tx_rlmptmplselector_main_tmpl.disabled = 1

// TCEFORM.pages.tx_rlmptmplselector_ca_tmpl.removeItems = 0

我尝试使用原始的 ts_default.ts 并对其进行了更改,就像它在自述文件中一样。但是 Body-Tag 仍然是空的。

从 ts_default.ts 中删减:

tt_content.list.20.rlmptmplselector_templateselector  {

      // Define the paths leading to our HTML template files
  settings.templatePathMain = fileadmin/templates/
  settings.templatePathSub = fileadmin/templates/sub/
templatePathMain = fileadmin/templates/
templatePathSub = fileadmin/templates/sub/
      // Define the filenames used as the default HTML templates
  defaultTemplateFileNameMain = hundb_main.html
  defaultTemplateFileNameSub = einspaltig.html
  settings.defaultTemplateFileNameMain = hundb_main.html
  settings.defaultTemplateFileNameSub = einspaltig.html

      // If there is a page having no template selected, use a template
      // selected earlier in the rootline. If there is none, use the default
   inheritMainTemplates = 1
   inheritSubTemplates = 1

   templateObjects.main {
        10 < templateStandard

    }
}

plugin.tx_automaketemplate_pi1 {
    content < tt_content.list.20.rlmptmplselector_templateselector 

    elements {
    BODY.all = 1
    BODY.all.subpartMarker = DOCUMENT_BODY

    HEAD.all = 1
    HEAD.all.subpartMarker = DOCUMENT_HEADER
    HEAD.rmTagSections = title

    TD.all = 1
    DIV.all = 1
  }
    relPathPrefix = fileadmin/templates/

}



// --- SETUP SUBPARTS  ----------------------------------------------------------------------

temp.contentAreaTemplate = TEMPLATE
temp.contentAreaTemplate {

   template =< plugin.tx_automaketemplate_pi1

      // Modify the template selector config: This is a sub template!
   template.content.templateType = sub

   workOnSubpart = DOCUMENT_BODY

   subparts.column_normal < temp.contentnormal
   subparts.column_left < temp.contentleft
   subparts.column_right < temp.contentright
}

temp.mainTemplate = TEMPLATE
temp.mainTemplate {
    template =< plugin.tx_automaketemplate_pi1
    workOnSubpart = DOCUMENT_BODY
    subparts {
        content < temp.contentAreaTemplate
        mainmenu  < temp.mainmenu
        figur < temp.figur
        logo < temp.logo
        headertextc < temp.headertextc
        headertextb < temp.headertextb
        headertexta < temp.headertexta
    }        
}

我尝试在 PHP 中对其进行调试,但找不到任何东西。 我得到的一条线索:

 typo3conf/ext/rlmp_tmplselector/Classes/Controller/TemplateSelectorController.php:
      var_dump($tmplConf);

输出:

runarray(10) {
  ["templateType"]=>
  string(4) "main"
  ["templatePathMain"]=>
  string(24) "fileadmin/template/main/"
  ["templatePathSub"]=>
  string(23) "fileadmin/template/sub/"
  ["defaultTemplateFileNameMain"]=>
  string(0) ""
  ["defaultTemplateFileNameSub"]=>
  string(0) ""
  ["defaultTemplateObjectMain"]=>
  string(2) "10"
  ["defaultTemplateObjectSub"]=>
  string(2) "10"
  ["templateObjects."]=>
  array(2) {
    ["main"]=>
    string(0) ""
    ["sub"]=>
    string(0) ""
  }
  ["inheritMainTemplates"]=>
  string(1) "0"
  ["inheritSubTemplates"]=>
  string(1) "0"
}

空的 defaultTemplateFileNameMain 会不会是错误,我要写什么来填充它?

提前感谢您的任何建议!

【问题讨论】:

    标签: php templates typo3 typoscript typo3-6.2.x


    【解决方案1】:

    我在从 4.5 更新到 6.2 时遇到了同样的情况

    我的解决方案是:

    • 在我的主模板中包含静态模板css_styled_content(解决了空体标签)
    • 将扩展 automaketemplate 更新到 0.2.0 并将 rlmp_tmplselector 更新到 2.2.1
    • 按照自述文件中的说明修改 TS

    我生成的 TS 与您的相似,但 在您的问题中引用的 TS 中

    template.content.templateType = sub
    

    必须改为

    template.content.settings.templateType = sub
    

    我还用

    定义了模板文件
    tt_content.list.20.rlmptmplselector_templateselector.settings{
        defaultTemplateFileNameMain = my_main_templ.html
    }
    

    所以我不知道为什么调试输出中的 defaultTemplateFileNameMain 是空的。调试输出似乎显示了 rlmp_tmplselector 的默认 TS。也许您在读取设置之前插入了 var_dump,或者可能无法正确包含整个 TS。

    【讨论】:

    • 我自己没有找到解决方案。所以我们把这项任务外包了,但还是谢谢你。
    【解决方案2】:

    旧代码

    # Set the main subparts in the template
    page.10 = TEMPLATE
    page.10 {
    template =< plugin.tx_rlmptmplselector_pi1
    workOnSubpart = DOCUMENT
    subparts.LOGO < styles.content.getLOGO
    subparts.BANNER < styles.content.getBANNER
    subparts.LEFT < styles.content.getLEFT
    subparts.CENTER < styles.content.getCENTER
    subparts.RIGHT < styles.content.getRIGHT
    subparts.FOOTER < styles.content.getFOOTER
    subparts.HEADERRIGHT < styles.content.getHEADERRIGHT
    subparts.CONTENTLEFT < styles.content.getCONTENTLEFT
    subparts.COLOUR < styles.content.getCOLOUR
      subparts.GOOGLESEARCH < styles.content.getGOOGLESEARCH
    }
    

    对此进行更新

    # Set the main subparts in the template
    page.10 = TEMPLATE
    page.10 {
    template =< tt_content.list.20.rlmptmplselector_templateselector
    workOnSubpart = DOCUMENT
    subparts.LOGO < styles.content.getLOGO
    subparts.BANNER < styles.content.getBANNER
    subparts.LEFT < styles.content.getLEFT
    subparts.CENTER < styles.content.getCENTER
    subparts.RIGHT < styles.content.getRIGHT
    subparts.FOOTER < styles.content.getFOOTER
    subparts.HEADERRIGHT < styles.content.getHEADERRIGHT
    subparts.CONTENTLEFT < styles.content.getCONTENTLEFT
    subparts.COLOUR < styles.content.getCOLOUR
      subparts.GOOGLESEARCH < styles.content.getGOOGLESEARCH
    }
    

    旧代码:

    plugin.tx_rlmptmplselector_pi1 {
        templatePathMain = fileadmin/templates/html/
        defaultTemplateFileNameMain = inside.html
        inheritMainTemplates = 0
    }
    

    对此进行更新:

    tt_content.list.20.rlmptmplselector_templateselector  {
    
          // Define the paths leading to our HTML template files
      settings.templatePathMain = fileadmin/templates/html/
    
          // Define the filenames used as the default HTML templates
      settings.defaultTemplateFileNameMain = inside.html
    
          // If there is a page having no template selected, use a template
          // selected earlier in the rootline. If there is none, use the default
       settings.inheritMainTemplates = 0
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-13
      • 1970-01-01
      • 1970-01-01
      • 2015-04-24
      相关资源
      最近更新 更多