0

这是 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
}
}

一切正常。列表按应有的方式显示。除了最后一项之外,详细视图也是如此。当我单击它时,详细视图会显示一个空白页面。没有信息,好像查询什么也没得到。

这是模板,虽然非常简单。 成员列表.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>
4

1 回答 1

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 副作用(如缺少权限、语言、工作区版本等)。

于 2013-09-26T13:28:59.190 回答