[TYPO3-english] advanced typoscript wrapping needed
JoH asenau
info at cybercraft.de
Thu Apr 30 16:07:24 CEST 2009
> One difference with my previous solution regarding to the endresult is
> that "To Top" links now fall outside the public/membersonly/ctonly
> containers, whereas before they were inside. Not an important
> difference but still. (Before the closing </div> was part of the
> wrap, now it's postCObject).
Well - besides the problems that Bernd already posted before, this solution
won't work due to caching problems.
You are working with "if" inside conditions, which might not be a problem as
long as "if" is checking data coming from content elements. But in this case
it is checking data that changes dynamically based on the frontend user
currently logged in.
While conditions will put a different version of the page into the cache
depending on the different options, "if" won't do that.
So the first one who save wins and the version that this user created will
be visible for all other users matching the same condition.
You should at least switch to COA_INT instead of COA and IMHO it would be
much better to use outerWrap.cObject to create a full wrap instead of those
preCObjects you are using.
Currently I am thinking about another solution using LOAD_REGISTER and
conditions, but I am not sure if this will work, since the registers might
be nont available when conditions are parsed.
HTH
Joey
> # Default
>
> temp.PageAccess = TEXT
> temp.PageAccess.value = <div class="publicpage">
>
> temp.MainContentWrap = TEXT
> temp.MainContentWrap.value = <div class="public">
>
> # Public Page
>
> [globalVar = TSFE:page|fe_group = ,TSFE:page|fe_group =
> 0,TSFE:page|fe_group = -1]
> temp.MainContentWrap = COA
> temp.MainContentWrap {
> 10 = TEXT
> 10.value = <div class="public">
> 10.if {
> value = -2,1,2
> isInList.field = fe_group
> negate = 1
> }
> 20 = TEXT
> 20.value = <div
> class="membersonlytext">{$text.contentmembersonly}</div><div
> class="membersonly">
> 20.if {
> value = -2,1
> isInList.field = fe_group
> }
> 30 = TEXT
> 30.value = <div class="ctonlytext">Coordination Team Only</div><div
> class="ctonly">
> 30.if {
> value = 2
> equals.field = fe_group
> }
> }
> [END]
>
> # Members-Only Page
>
> [globalVar = TSFE:page|fe_group = -2,TSFE:page|fe_group = 1] &&
> [usergroup = 1,2]
> temp.PageAccess = TEXT
> temp.PageAccess.value = <div
> class="membersonlytext">{$text.pagemembersonly}</div><div
> class="membersonlypage">
>
> temp.MainContentWrap = COA
> temp.MainContentWrap {
> 10 = TEXT
> 10.value = <div class="public">
> 10.if {
> value = 2
> isInList.field = fe_group
> negate = 1
> }
>
> 30 = TEXT
> 30.value = <div class="ctonlytext">Coordination Team Only</div><div
> class="ctonly">
> 30.if {
> value = 2
> equals.field = fe_group
> }
> }
> [END]
>
> # CT-Only Page
>
> [globalVar = TSFE:page|fe_group = 2] && [usergroup = 2]
> temp.PageAccess = TEXT
> temp.PageAccess.value = <div class="ctonlytext">Coordination Team Only
> Page</div><div class="ctonlypage">
>
> temp.MainContentWrap = COA
> temp.MainContentWrap {
> 10 = TEXT
> 10.value = <div class="public">
> 10.if {
> value = -2,1,2
> isInList.field = fe_group
> negate = 1
> }
> 20 = TEXT
> 20.value = <div
> class="membersonlytext">{$text.contentmembersonly}</div><div
> class="membersonly">
> 20.if {
> value = -2,1
> isInList.field = fe_group
> }
> 30 = TEXT
> 30.value = <div class="ctonlytext">Coordination Team Only</div><div
> class="ctonly">
> 30.if {
> value = 2
> equals.field = fe_group
> }
> }
> [END]
>
> temp.MainContent < styles.content.get
> temp.MainContent.renderObj.stdWrap.wrap = <div
> class="content-unit">|</div>
> temp.MainContent.renderObj.stdWrap.stdWrap.preCObject <
> temp.MainContentWrap
> temp.MainContent.renderObj.stdWrap.stdWrap.postCObject = HTML
> temp.MainContent.renderObj.stdWrap.stdWrap.postCObject.value = </div>
--
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
Xing: http://contact.cybercraft.de
Twitter: http://twitter.com/bunnyfield
TYPO3 cookbook (2nd edition): http://www.typo3experts.com
TYPO3 workshops: http://workshops.eqony.com
More information about the TYPO3-english
mailing list