TypoScript构建的列表的最后一项的详细视图始终为空白

时间:2013-09-23 14:16:16

标签: typo3 typoscript

这是TypoScript代码。

lib.membersList = CONTENT
lib.membersList{
table = tt_address
select{
    pidInList = {$membersStorageFolder}
    orderBy = zip, last_name
}

wrap = <div class="membersList">|</div>

renderObj = COA
renderObj{
    10 = FLUIDTEMPLATE
    10{
        file = fileadmin/templates/ext/memberslist/templates/membersList.html

        variables{

            portrait = IMAGE
            portrait{
                file.import = uploads/pics/
                file.import {
                    field = image
                    listNum = 0
                }
                file.height = 105
                file.width = 105c

                stdWrap.typolink{
                    parameter = {$membersPageId}
                    additionalParams.dataWrap = &ts_addresslist[showUid]={field:uid}
                    #returnLast = url
                    # The cache hash is needed to display the right content, since we are not running as USER_INT
                    useCacheHash = 1

                }
            }

            lastName = TEXT
            lastName.field = last_name
            lastName.typolink{
                 parameter.data = TSFE:id
                 additionalParams.dataWrap = &ts_addresslist[showUid]={field:uid}
                 # The cache hash is needed to display the right content, since we are not running as USER_INT
                 useCacheHash = 1

             }

            firstName = TEXT
            firstName.field = first_name
            firstName.typolink{
                 parameter.data = TSFE:id
                 additionalParams.dataWrap = &ts_addresslist[showUid]={field:uid}
                 # The cache hash is needed to display the right content, since we are not running as USER_INT
                 useCacheHash = 1

             }

            title = TEXT
            title.field = title

            organisation = TEXT
            organisation.field = company

            country = TEXT
            country.field = country

            city = TEXT
            city.field = city
        }
    }

}


stdWrap.override.cObject = CONTENT

stdWrap.override.cObject{
    table = tt_address
    select {
      andWhere.data = GP:ts_addresslist|showUid
      # Make sure there is no SQL injection!
      andWhere.intval = 1
      andWhere.wrap = uid=|
      orderBy = last_name ASC
      pidInList = {$membersStorageFolder}
    }

    wrap = <div class="membersDetail">|</div>

    renderObj = FLUIDTEMPLATE
    renderObj{

       file = fileadmin/templates/ext/memberslist/templates/membersDetail.html

       variables{

           portrait = IMAGE
           portrait{
               file.import = uploads/pics/
               file.import {
                   field = image
                   listNum = 0
               }
               file.height = 105
               file.width = 105c
           }

           lastName = TEXT
           lastName.field = last_name

           firstName = TEXT
           firstName.field = first_name

           title = TEXT
           title.field = title

           organisation = TEXT
           organisation.field = company

           country = TEXT
           country.field = country

           city = TEXT
           city.field = city

           detail = TEXT
           detail.field = description
       }
    }

    renderObj.stdWrap.append = TEXT
    renderObj.stdWrap.append{
        value = << Back to list
        typolink.parameter = {$membersPageId}
    }
}

stdWrap.override.if {
        isTrue.data = GP:ts_addresslist|showUid
        isTrue.intval = 1
}
}

一切都很好。列表按原样显示。除最后一项外,详细视图也是如此。当我点击它时,详细视图显示一个空白页面。没有信息,好像查询没有提取任何内容。

以下是模板,但非常简单。 的 membersList.html

<section>
{portrait -> f:format.raw()}
<div class="memberDetail">
    <h1>{lastName -> f:format.raw()} {firstName -> f:format.raw()}</h1>

    <h2>{title} - {organisation}</h2>

    <h3>{country} - {city}</h3>
</div>
</section>

membersDetail.html

<section>
{portrait -> f:format.raw()}
<div class="memberDetail">
    <h1>{lastName} {firstName}</h1>

    <h2>{title} - {organisation}</h2>

    <h3>{country} - {city}</h3>
</div>
<div class="bio">
    {detail}
</div>
</section>

1 个答案:

答案 0 :(得分:0)

到目前为止,您的代码看起来正确。出于调试目的,将其直接添加到页面对象。

page.38388383 = CONTENT
page.38388383 {
  table = tt_address
  select{
    pidInList = {$membersStorageFolder}
    orderBy = zip, last_name
  }
  wrap = <div class="membersList">(|)</div>

  renderObj = COA
  renderObj{
    10 = TEXT
    10.field = uid
    10.wrap = (|),
  }
}

有了这个,你应该得到一个逗号分隔的所有tt_address记录列表,没有副作用。如果这不起作用,请检查数据库级别是否一切正确。也许你在语言,工作空间等方面遇到麻烦......?

如果这个工作方式与预期的一样,您可以用这个替换你的renderObj,看看会发生什么。

如果期望没有疯狂的循环效果 - 但是一些CMS副作用(如缺少权限,语言,工作区版本等)。