Lightbox in TYPO3

Lightbox in TYPO3

Leggere le mailinglist di TYPO3 aiuta sempre ad imparare qualcosa di nuovo.

Nell'intervento al T3Camp Italia del 2011 suggerivo di non installare estensioni, quando lo stesso risultato si puo' raggiungere con qualche riga di TypoScript.

Questo permette di non essere vincolati a limitazioni di aggiornamento, bug presenti nel codice, manuali da leggere e magari anche codice su cui dover fare debug perche' non si comporta correttamente.

Un bellissimo esempio riguarda l'utilizzo di lightbox in TYPO3 ed e' suggerita da Georg Ringer. Perche' installare estensioni quando sono sufficienti le seguenti righe:

# ***************************************************************

# (c) 2012 Georg Ringer <typo3@ringerge.org>

#

# You can redistribute it and/or modify it under the terms
# of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License,

# or (at your option) any later version.

# ***************************************************************

# **********************************************************

# Lightbox implementation by using plain TypoScript

# and fancybox, see fancybox.net for details

# **********************************************************

# Add the CSS / JS files

page {

includeCSS {

file5 = fileadmin/fancybox/jquery.fancybox-1.3.4.css

}

includeJSFooter {

# Optional

jquery_easing = fileadmin/fancybox/jquery.easing-1.3.pack.js

# fancybox library

fancybox = fileadmin/fancybox/jquery.fancybox-1.3.4.pack.js

# Enabling lightbox for content images + configuration

enable_fancybox = fileadmin/fancybox/enable_fancybox.js

}

}

# Change rendering of images to fit the needs of the lightbox requirements

tt_content.image.20.1.imageLinkWrap {

  JSwindow = 0

  directImageLink = 1

  linkParams.ATagParams {

    dataWrap = class= "lightbox" rel="fancybox{field:uid}"

  }

}