Haythem Labbassi : Dévelopeur Web TYPO3

Blog d'un développeur web Tunisien, connaissance approfondie en PHP, MySQL, Ajax, CMS (Typo3, Magento, Joomla, Xoops, WordPress, Drupal, Bootika…)


Cet article explique le fonctionnement de l’extension RandomImage qui permet d’afficher une image aléatoire dans une page.

Tout d’abord, il faut stocker les images dans un répertoire sous fileadmin, par exemple fileadmin/randomimages. Ensuite, il faut ajouter le code typoscript suivant :


includeLibs.tx_ccrandomimage = EXT:cc_random_image/pi1/class.tx_ccrandomimage_pi1.php

lib.imagerandom = USER_INT
lib.imagerandom {
userFunc = tx_ccrandomimage_pi1->main

path = fileadmin/randomimages/
fileExt = jpg,jpeg,gif,png

renderObj = IMAGE
renderObj {
file = ###FILE_1###
width = 500
height = 250
}
}

Enfin, il faut ajouter le template statique de l’extension cc_random_image dans « Include static (from extensions) » de notre gabarit.

Télécharger l'extension RandomImage

0 commentaires

Enregistrer un commentaire

Inscription à : Publier les commentaires (Atom)