[Typo3] Syntax problem with TS and {page:uid}

Christopher bedlamhotel at gmail.com
Sun Nov 20 09:49:42 CET 2005


Hi,

On 20/11/05, Ralph Brugger <news.netfielders.de at public.linkpool.de> wrote:
> Hi,
>
> hope someone can understand my "english":
>
> I'm working on the example "Creating additional page templates" from
> FTB1 on wiki.typo3.org:
> wiki.typo3.org/index.php/TemplaVoila/FTB1#Creating_additional_page_templates
>
> This example works really good
>
> But now I wanted to change the text link into an Link around an
> GITBUILDER object.
>
> I've changed the code like this:
>

<snip>

>
> This doesn't work as expected. The link shown in the browser is not:
>
> http://XXX/index.php?id=12&print=1&no_cache=1
>
> but
>
> http://XXX/index.php?id={page:uid}&print=1&no_cache=1
>
> The value of "{page:uid}" won't be set used as part of the link, but the
> text "{page:uid}" is used.
>
> What am I doing worng?


You'll need to do a little research into .stdWrap and datatypes.
Here're the urls of two longish posts I've made on the subject in
answer to similar questions:

Message 2 of:
http://typo3.org/documentation/mailing-lists/english-main-list-archive/thread/110181995/?tx_maillisttofaq_pi1%5Bpointer%5D=14&tx_maillisttofaq_pi1%5Bmode%5D=1

Slightly different problem, same solution:
http://lists.netfielders.de/pipermail/typo3-english/2005-August/010891.html

To summarize, you need to:

1. Find out what datatype might be useful to provide the information
you need from the datatype reference [1] (hint: probably it will be
'gettext'),

2. Make sure that the property you're using (in this case, it's the
IMAGE object's '.wrap' property) has the '->stdWrap' datatype (because
TS objects rarely implement the 'gettext' datatype directly, but many
.stdWrap objects do...)

3. Find an appropriate .stdWrap property

In the case you've shown above, you're trying to wrap an image in a
link where the href attribute is dynamically set--but when you consult
the TSref [3], you find that no property of the IMAGE object has the
'gettext' datatype. However, the .stdWrap property has the '->stdWrap'
data type.

Furthermore, looking at the examples on the stdWrap page in the TSref
[2], you'll see that the stdWrap property you're trying to use above
is called .dataWrap. Fom this, you might conclude that what you need
is this [abbreviated sample]:

lib.headerDown = IMAGE
lib.headerDown {
  stdWrap.dataWrap = <a href="index.php?id={field:uid}&print=1&no_cache=1">|</a>
}

This _will_ wrap your image in a link, but it might be unsatisfactory
since the url will _not_ change if you're using RealURL to create
links such as http://www.example.com/foo/bar/ or if you're using
'simulateStaticDocuments' to create urls like
http://www.example.com/foo.html.

But if you browse through the stdWrap part of the TSref long enough,
you will eventually come on a property called .typolink (about which,
more information at [4]). This object can be used to create what you
might call 'Typo3-friendly' links (i.e. links that'll change if you're
using any link-manipulating features or extensions). You could use
typolink to create the same link as above this way:

lib.headerDown = IMAGE
lib.headerDown {
  stdWrap.typolink {
    parameter.data = page:uid
    additionalParams = &print=1&no_cache=1
  }
}


-Christopher


[1] http://typo3.org/documentation/document-library/doc_core_tsref/Datatype_reference/
[2] http://typo3.org/documentation/document-library/doc_core_tsref/stdWrap/
[3] http://typo3.org/documentation/document-library/doc_core_tsref/IMAGE/
[4] http://typo3.org/documentation/document-library/doc_core_tsref/typolink/



More information about the TYPO3-english mailing list