[Typo3] [TemplaVoila][How to get the current page title and title of page one level be ]

Christopher bedlamhotel at gmail.com
Fri Sep 30 04:04:32 CEST 2005


Hi,


On 29/09/05, A00781428 at itesm.mx <A00781428 at itesm.mx> wrote:
> Hi,
> as you can notice i'm starting with typo3 and i got stuck, so that's why
> i'm asking your help.
>
> What i want to do is to get de current page title and the page title of the
> page one level before the current page and display both
> First of all i created in DS a field type=Element and Editing type=TypoScript
> Object Path, the object is lib.contenido,
> So in the setup i wrote this code:
>
> lib.contenido = TEXT
> lib.contenido.field = title
>
> also i tried this one:
> lib.contenido = TEXT
> lib.contenido.data = global:id
>
> and this one:
> lib.contenido = COA
> lib.contenido.10 = TEXT
> lib.contenido.10 {
>   value = This is the page title:
>   wrap = <font face="verdana" size=1>|</font>
>   wrap2 = | <BR>
>   case = upper
> }
> lib.contenido.20 = TEXT
> lib.contenido.20.field = title
>
> but nothing worked, in the last example i just saw "This is the page title:"
>
> i really can't understand why it is not working
>
> the type of menu i'm using is TMENU
>
>
> i really hope u can help me
> Thank you
>

You might want to get your email program to put your name in the
'From' field - when I see a name like 'A00781428' the first thing I
think of is spam...

In any case, you need to become familiar with the datatypes [1]
available to the various stdwrap properties [2]. I can see that you've
seen some examples, but haven't fully grasped them yet (e.g.
"lib.contenido.data = global:id" doesn't exist...), so here's a _very_
short tutorial.

You've used the stdWrap property 'data'; if you check the stdWrap part
of the TSref, you'll see that the 'Data Type' for 'data' is 'getText'.
If you then check the Datatype Reference part of the TSref, you'll
find that the 'getText' datatype is the most all-around useful one for
getting dynamic information into TS content objects. For what you're
trying to do, the first part is quite straightforward; you just need
the following:

lib.contenido = COA
lib.contenido {
  10 = HTML
  10 {
    value.data = page:title
  }
}

The second part is slightly trickier, but if you read through the
'getText' part of the datatypes, you'll eventually see things like
'leveltitle' - which happens to be one property that you can use to do
what you're trying to do. The level* items are quite useful in that
you can use them to retrieve values from other levels of the page tree
both when the level is known in advance (e.g. value.data = leveluid:0
gets the id of the root page of the site), and when the tree level is
not known (these are the cases in the examples where negative numbers
are used).

Anyway, the complete TS object should look like this:

lib.contenido = COA
lib.contenido {
  10 = HTML
  10 {
    value.data = page:title
  }

  20 = HTML
  20 {
    value.data = leveltitle:-2
  }
}


-Christopher


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



More information about the TYPO3-english mailing list