Home

Evolution Of My Footer Code - Part 1

Tuesday, June 03rd, 2008 | Author: Benni

Everybody started out very simple with TYPO3. In case of my projects, I had to update the copyright year, with all my clients of course. At first, I put everything static in my HTML template, so I had to change the year there. Then I put the static string in TypoScript. Nowadays I enjoy the power of TypoScript that automatically updates the year in the footer for me. This means less client calls at the beginning of the year :)

  • Pre 2004: Kept everything in my HTML file
  • 2005: Had a marker in my HTML file, that my TEMPLATE object replaced
  • 2006: Used TemplaVoila with defined footer fields, matching a TS object (lib.footer)
  • Post 2007: Used stdWrap effectively for my lib.footer object

This is how it looks like if you just need a “self-updating” footer:
lib.footer = TEXT
lib.footer {
data = date:U
strftime = %Y
wrap = © |  b:dreizehn GbR • More stuff
}

The TEXT object has stdWrap methods at the base level, so I took “date:U” from the “getData” type, ran it through a strftime and wrapped it in my HTML code.

For many years (actually until 2006), most parts of stdWrap were a closed book for me, but if you read the source code itself, it all comes down to you. So simple, so powerful. Check out the source in your TYPO3 package (”typo3/sysext/cms/tslib/class.tslib_content.php”).

Quite simple, and if you think about it, you could have done that by yourself easily, right?

However, that’s not all that you can do with TypoScript, more to come…

Tags » , «

Trackback: Trackback-URL | Comments Feed: RSS 2.0
Category: TYPO3

You can leave a response.

3 Responses

  1. Excellent . . . I have been wondering about this for a while, but never got round to really looking into it. Thanks for the tip!

  2. Hello Benni!

    I have use same technique for copyrights, but leave for user ability to change the code.

    Copyright code looks like:

    lib.copyright = RECORDS
    lib.copyright {
    source = 100
    tables = tt_content
    stdWrap {
    preCObject = LOAD_REGISTER
    preCObject.currentYear.data = date: Y
    insertData = 1
    }
    }

    Then content with uid=100 looks like:

    © 2005-{register:currentYear}, Company

  3. Hello Benni,

    this is a very good idea, I have integrated it in one of my free typo3 templates as example: http://bitter-sweet.typo3-template.info/index.php?id=4

    Greetings Lina

Leave a Reply