[TYPO3] Newbie question

Dmitry Dulepov typo3 at fm-world.ru
Mon Jan 16 10:51:43 CET 2006


Hi!

jasper22 wrote:
>  I'm very new to TYPO and trying to understand how it's works :)

Well, this will not be easy :)

> While searching the list for date-time help I found a topic with typo
> script:
> ...
> Can someone explain how it's work?

Yes, and this is easy :) But to understand this you need TSRef under the
hand. TsRef (and correct page from it) is here:
http://typo3.org/documentation/document-library/doc_core_tsref/CONTENT/

Let's see:

> temp.lc_date = CONTENT

So, this is CONTENT object.

> temp.lc_date {
>    table = tt_content

Its 'table' property is set to tt_content, which actually can be skipped
because TSRef says: "The table, the content should come from. In
standard-configurations this will be "tt_content"". You can remove this
entry completely and its default value will be used.

>    select {

Okay, TSRef says that it is "select" function. Let's see what TSRef says
about "select" function
(http://typo3.org/documentation/document-library/doc_core_tsref/select/)

>       orderBy = tstamp DESC
>       max = 1
>    }

These two properties are described in TSRef, so nothing extra to say here.

>    renderObj = TEXT

TSRef does not say what renderObj is but judging from its name and type
(cObj) we can says that it is a content object that renders selected
content. So it is TEXT.

>    renderObj {

If you take a look to TEXT content object, you will see that any of its
properties (except "value") are actually stdWrap properties. Let's see
stdWrap function
(http://typo3.org/documentation/document-library/doc_core_tsref/stdWrap/)

>       field = tstamp

So, stdWrap's "field" property says which field to render.

>       date = d.m.y - H:i

"date" has a type "date-conf" and description says what it is. Since it
is a data type, you can find it in "Datatype reference" section
(http://typo3.org/documentation/document-library/doc_core_tsref/Datatype_reference/).

Putting it all together gives you:

1. temp.lc_date is a content object of type CONTENT
2. It selects 1 record from database ordering record by "tstamp DESC"
3. This record is redered by TEXT object
4. TEXT object uses tstamp field from the fetched record and formats it
using specified date format.

Now I will analyze your interpretation of this TS:

> 1) I create some temporary variable temp.lc_date

Correct

> 2) I set this variable to CONTENT object type

Correct

> 3) Inside variable 'table' is set to tt_content

Correct

> 4) I'm running 'select' command on tt_content with warious parametrs

Correct

> (how does it know that it should run on 'table' ??)

because CONTENT object ensures this

> 5) Create another variable 'renderObj' and set it to TEXT type

Wrong, this is not a variable but a property of CONTENT object

> 6) 'renderObj' will select only 'tstamp' field from previous 'table' and
> receive value 'date' from 'tstamp' column (is that right ?)

Wrong. It will not select anything because "select" selects record. It
will only *use* value of tstamp field from the selected record. You
could optimize query using something like:

select {
   selectFields = tstamp
   orderBy = tstamp DESC
   max = 1
}

> How those variables working with each other ? How 'select' is running on
> 'table' and 'renderObj' working on result table ?

This is why you need TSRef. It answers these and many other questions :)

Dmitry.



More information about the TYPO3-english mailing list