整个 COA 上的错别字

typolink on whole COA

我正在尝试围绕我的所有内容对象设置一个 link,以便包装整个内容。到目前为止,我已经尝试过这样的事情:

#Rendering start box text with image
ap_content.textpic.100  = COA
ap_content.textpic.100{
    wrap = <div class="start-box-wrapper link">|</div>
    10 = FILES
    10{               
        references{
            table = tt_content
            uid.field = uid
            fieldName = image
        }            
        renderObj = COA
        renderObj{
            wrap = <img class="lazy img-responsive" src="fileadmin/{$folderName}/Resources/Public/Images/loading-spin.svg"|/>

            11 = IMG_RESOURCE
            11{
                stdWrap.noTrimWrap = | data-src="|"|
                file{
                    import.data = file:current:originalUid // file:current:uid
                    maxW{
                        if.isTrue.field = tx_t3webkit_retina
                        cObject = USER
                        cObject {
                            userFunc = usr_t3webkitHelpers->getImageDimensions
                            userFunc{
                                picture = IMG_RESOURCE
                                picture{
                                    file.import.data = file:current:originalUid // file:current:uid    
                                }
                                device = desktop
                                type = w
                            }
                        }    
                    }
                }
            }
            12 = IMG_RESOURCE
            12{
                stdWrap.noTrimWrap = | data-src-retina="|"|
                file.import.data = file:current:originalUid // file:current:uid
            }
            13 = TEXT
            13{
                data = file:current:name
                replacement{
                    10 = TEXT
                    10{
                        search.cObject = TEXT
                        search.cObject{
                            wrap = .|
                            data = file:current:extension
                        }
                        replace =
                    }
                }
                override.data = file:current:alternative
                stdWrap{
                    required = 1
                    noTrimWrap = | alt="|"|
                }   
            }
        } 
    }
    20 = COA
    20{    

##################### 这里是问题##################

 stdWrap {
        innerWrap = <div class="start-box-bg"><div class="start-box-txt">|</div></div>
        typolink.parameter = 3
        } 


        23 = TEXT   
        23{
            field = header
            wrap = <h4>|</h4>
            replacement{
                10{
                    search = |
                    replace = &shy;
                }
            }    
        }
        24 = TEXT
        24{
            field = bodytext
            parseFunc =< lib.parseFunc_RTE
        }
        25 = TEXT
        25{
            data = LLL:fileadmin/{$folderName}/Resources/Private/Language/template.xml:content.stratbox.link
            typolink{
                parameter.field = header_link
                ATagParams = class="btn"
            }
        }

    }
    30 = TEXT
    30{
        wrap = <div class="teaser"><h4>|</h4></div>
        field = header
        replacement{
            10{
                search = |
                replace = &shy;
            }
        }
    }
}

它没有产生预期的结果,怎么了? 他正在关闭 a 标签或者他只包装内容而不是整个 div:

<div class="start-box-wrapper link">
<img ... />
<!-- this content is sliding over the image -->
    <a href="header_link"> header text</a>
    <div class="start-box-bg" style="left: -100%;">
    <div class="start-box-txt">
    <a href="header_link">
    <h4>header</h4>
    </a>
    <a href="header_link">
    <p class="bodytext">Lorem Ipsum </p>
    </a>
    </div>
</div>
    </div>

以下代码片段生成所需的输出。用TYPO3测试过 7.6.x.

page = PAGE
page {
  typeNum = 0

  10 = COA
  10 {
    stdWrap {
      innerWrap = <div class="start-box-bg"><div class="start-box-txt">|</div></div>
      typolink.parameter = 3
    }

    10 = TEXT
    10 {
      value = Test
      wrap = <h4>|</h4>
    }

    20 = TEXT
    20 {
      value = More text to go with lorem ipsum.
      wrap = <p>|</p>
    }
  }
}

生成的 HTML 如下所示:

<a href="index.php?id=3">
  <div class="start-box-bg">
    <div class="start-box-txt">
      <h4>Test</h4>
      <p>More text to go with lorem ipsum.</p>
    </div>
  </div>
</a>

根据作者给出的代码片段,生成如下HTML:

<div class="start-box-wrapper link">
    <a href="index.php?id=3">
        <div class="start-box-bg">
            <div class="start-box-txt">
                <h4>Title &shy;&shy; mit Separator</h4>
                Ich <link 38>bin</link> <b>Bodytext</b>.<a href="index.php?id=28" class="btn">Test</a>
            </div>
        </div>
    </a>
    <div class="teaser"><h4>Title &shy;&shy; mit Separator</h4></div>
</div>

对于这种特殊情况,问题是由 HTML 无效引起的。复杂的 TypoScript 代码生成嵌套的 a-tags。浏览器的控制台不显示 "correct" HTML 输出。 HTML 源代码显示嵌套。所以删除内部的 a-tag 解决了问题。