[TYPO3-english] TypoScript: conditional wrap question

Michael Cannon mc at acqal.com
Sat Sep 26 11:42:45 CEST 2009


The TypoScript below works as desired, but I feel there's a simpler way.

Any help? The successful helpers will be mentioned in an upcoming Acqal
Blogging post. Thank you!


Output

no page author or page email, then no tag

page author only exists
<meta name="author" content="Michael Cannon" />

page email only exists
<meta name="author" content="mc at acqal.com" />

both page author or page email exists
<meta name="author" content="Michael Cannon (mc at acqal.com)" />
--

    # Building the Author tag
    80 = COA
    80 {
        10 = TEXT
        10 {
            required = 1
            data = page:author
        }

        # wrap email if author exists
        20 = TEXT
        20 {
            required = 1
            data = page:author_email
            noTrimWrap = | (|)|
            if.isTrue.data = page:author
        }

        # don't wrap email if author exists
        30 = TEXT
        30 < .20
        30 {
            noTrimWrap >
            if >
            if.isFalse.data = page:author
        }

        stdWrap {
            required = 1
            wrap = <meta name="author" content="|" />
        }
    }

--
Michael Cannon
CEO, Acqal Corporation -- Official TYPO3 Agency for Website Content
Management
US +1 (404) 963-8850 x103  Taiwan +886 9 8329 0956  Fax +1 (866) 275-7385
Read more at http://Acqal.com/blog


More information about the TYPO3-english mailing list