[TYPO3] Typoscript: try to use a IF in IMG_RESOURCE construct
Patrick Rodacker
patrick.rodacker at the-reflection.de
Fri May 9 15:28:54 CEST 2008
Hi Andre,
Andre Dittmar wrote on 07.05.2008 18:49:
> Now if a static graphic exists, it will be shown. But unfortunately, the
> subtitle isn't considered if no static graphic exists. It must be the
> "if"-part in the code, I guess. If I set the if in the first part for
> the subtitle, it will always show a subtitle (as far at is exists) and
> never the static graphic.
>
> I already tried it with a CASE-construct, but it won't work either...
> :-/ Maybe someone has an idea about that?
> ---
>
> page.5 = LOAD_REGISTER
> page.5 {
> adRegisterHeadline.cObject = COA
> adRegisterHeadline.cObject {
> 10 = IMG_RESOURCE
> 10 {
> stdWrap.wrap = style="background-image:url(|);"
> file = GIFBUILDER
> file {
> XY = [10.w]+4,[10.h]+4
> backColor = #888888
> transparentBackground = 0
> 10 = TEXT
> 10 {
> text.data = page:subtitle
> text.case = upper
> fontSize = 20px
> fontFile = fileadmin/fonts/UniversLTStd-Cn.otf
> fontColor = #F3F3F3
> offset = 0,20
> niceText = 1
> }
> }
> }
> 10 {
> if.isTrue.field = tx_salmetextpages_graph_headline
> stdWrap.wrap = style="background-image:url(|);"
> file >
> file {
> import = uploads/tx_salmetextpages/
> import.field = tx_salmetextpages_graph_headline
> }
> required = 1
> }
> }
> }
you declare only one object in COA definitione (10) which gets rendered
only if the field tx_salmetextpages_graph_headline is selected. So
that's why the the subtitle never will be shown.
You could use the override setting of the stdWrap [1] function to load
the static image, or you could use a second object (20) for the static
image with the current if-clause and extend the first object with a
negated if-clause.
Please try for yourself first and come back if you are not successful,
that's the best way to learn ;-)
HTH
Patrick
[1]
http://typo3.org/documentation/document-library/references/doc_core_tsref/4.1.0/view/5/1/
More information about the TYPO3-english
mailing list