[TYPO3] ALT and TITLE for IMAGE cObject

JoH asenau info at cybercraft.de
Tue Dec 5 03:02:49 CET 2006


> This is my first post and I am working on my first Typo3 site located
> at:
>
> http://www.macchristianhigh.com/index.php
>
> So far I am getting things configured using the modern template
> building tutorials.
>
> I have an IMAGE cObject and I am not sure how to control the text for
> the ALT and TITLE variables within the <image> tag.
>
> Here is what I currently have and it it does not seem to work as my
> ALT and TITLE variables are still empty on the FE.  I have tried many
> different times to make this work with no success.
>
> temp.tab = IMAGE
> temp.tab {
>  file = fileadmin/template/main/homepage_tab.png
>  file.import.data = levelmedia: -1, "slide"
>  file.import = uploads/media/
>  file.import.listNum = 0
>  file.import.override.field = media
>  file.alttext.value = {page:title}
> }
>
> As you can see I was trying to set the images ALT text by using the
> following, file.alttext.value = {page:title}, and it does not work.
>
> I would like to set the text for both the ALT and TITLE variables of
> the <image> tag.  Can someone please help me with a snippet or a
> specific post/reference item that I can look at to figure this out.

Well - altText and titleText are properties of IMAGE and not IMAGE.file
override is not needed here, since levelmedia:-1 will start at the current
page and walk down the rootline until there's something returned.

So this one should do what you want:

temp.tab = IMAGE
temp.tab {
    file = fileadmin/template/main/homepage_tab.png
    file {
        import = uploads/media/
        import {
            data = levelmedia: -1, "slide"
            listNum = 0
        }
    }
    altText.field = title
    titleText.field = title
}

HTH

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your knob sometimes!)
Dieter Nuhr, German comedian
openBC/Xing: http://www.cybercraft.de
T3 cookbook: http://www.typo3experts.com




More information about the TYPO3-english mailing list