[TYPO3-mvc] How to display images of a specific category with a fluid template ?

Frans Saris franssaris at gmail.com
Thu Apr 3 14:46:28 CEST 2014


Hi Florian,

have a look at the categoryBasedFileCollection

https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/core/Classes/Resource/Collection/CategoryBasedFileCollection.php

gr. Frans

2014-04-02 10:43 GMT+02:00 Florian Rival <contact at oktopuce.fr>:
> Hi,
>
> I'm working with Typo3 V6.2 and I'd like to select images belonging to a
> specific category.
>
> In my template, I tried this :
>
>     <v:resource.image categories="2" as="resources">
>         {resources -> f:debug()}
>     </v:resource.image>
>
> But nothing is displayed, so, I looked in the code to see how it should work
> and I saw that the selection by category is in the file
> "AbstractResourceViewHelper.php" looking in the table
> 'sys_category_record_mm' :
>
>         if (FALSE === empty($categories)) {
>             $sqlCategories = implode(',',
> $GLOBALS['TYPO3_DB']->fullQuoteArray($categories,
> 'sys_category_record_mm'));
>             $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid_foreign',
> 'sys_category_record_mm', 'tablenames = \'sys_file\' AND uid_local IN (' .
> $sqlCategories . ')');
>         }
>
> but, in my case, the column 'tablenames' is 'sys_file_metadata' and not
> ''sys_file' so, I tried to change the table name and everything works fine :
>
>         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid_foreign',
> 'sys_category_record_mm', 'tablenames = \'sys_file_metadata\' AND uid_local
> IN (' . $sqlCategories . ')');
>
>
> So I would like to know if someone knows another way to select images by
> category.
>
> Thanks,
> Florian
>
> --
> Re: [TYPO3-dev] How to call Extbase controller action from piBase-Plugin?
>
> ==================================================
> Florian Rival
> Oktopuce
> tel.: +33-642-255-448
> fax : +33-985-375-102
> web: www.oktopuce.fr
> ==================================================
>
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc


More information about the TYPO3-project-typo3v4mvc mailing list