Mohsen Emami
Mohsen Emami

Reputation: 15

Problem with file_list extension of Typo3

I am pretty new in Typo3 world.

I'm trying to list all the files in a folder and parse them one by one. To list the files, I'm using "file_list" extension (https://docs.typo3.org/p/causal/file_list/2.4/en-us/Index.html) and following the image gallery tutorial (https://docs.typo3.org/p/causal/file_list/2.4/en-us/AdministratorManual/ExampleGallery/Index.html). To this end, I have created a folder at "/fileadmin/user_upload/test" and created three empty files in it for test purposes.

I have created these 4 files just as described in the tutorial:

This is the content of my "Configuration/TypoScript/setup.typoscript" file:

plugin.tx_filelist {
    view {
        partialRootPaths.100 = EXT:my_gallery/Resources/Private/Partials/
    }
    settings {
        path = file:1:/user_upload/test/
        mode = FOLDER
    }
}

I have also created MyGallery.html under "typo3conf/ext/my_gallery/Resources/Private/Partials" with the same content as in the tutorial.

I have the file "typo3conf/ext/my_gallery/Resources/Private/Templates/Default.html" which includes one line:

<f:render partial="MyGallery" />

In Typoscript backend, I have created a page with a template and included "My Gallery(my_gallery)" and "File List(file_list)" static extensions in it.

The setup section of the page includes:

page = PAGE
page.10 = FLUIDTEMPLATE
page.10 {
  templateName = Default
  templateRootPaths.1 = typo3conf/ext/my_gallery/Resources/Private/Templates
  partialRootPath = typo3conf/ext/my_gallery/Resources/Private/Partials
}

Now my page renders the template and partial in the frontend (I could confirm this by injecting dummy content) but does not show any folder list. According to the HTML template, I assumed there should be a "files" variable passed to the page, but when I reviewed the debug information, I could not even find such a variable.

I need help to parse the folder content in the frontend HTML file.

Upvotes: 1

Views: 579

Answers (1)

Stefan B&#252;rk
Stefan B&#252;rk

Reputation: 1358

Not tried it myself, but after a quick look into the documentations you linked.

Assuming everything was done corretly regarding the documentations, the point what you missed is following:

In the backend, in the page module, on any page create a new content element. There should be the filelist plugin. In the plugin option, there should be a option, where you can select your created "My Gallery" template.


Filelist is an extbase plugin. So it must be placed in a page. As alternative, you may add a typoscript to directly render a plugin instance into a template variabel, you can place / output in the template. Or in any template.

The first and easier option would be to place it in a page as content element.


If you want it as variable, you can create / rendet it as shown in the filelist documentation on https://docs.typo3.org/p/causal/file_list/2.4/en-us/AdministratorManual/BestPractices/TypoScript.html

If you add such a snippet to typoscript (propely modified to match your stuff).

You can render it in the page template with:

<f:cObject typoscriptObjectPath="lib.filelist" />

But this would display it on every page.

For the start, I would suggest to go the "put it as an content element on a page" way.

edit 1 / answer on your comment

Maybe something went wrong or you missed, when you followed the gallery exampel on https://docs.typo3.org/p/causal/file_list/2.4/en-us/AdministratorManual/

Would suggest to check every step clearly.

Things, which came in my mind:

  • missing include of the default static template from the filelist extension/plugin on the root page / root template record
  • missing include of the static template from your dedicated extension (like in the example)
  • wrong order of the static includes (eventully)
  • not enabled your dedicated extension
  • missing cache clear
  • ..

Upvotes: 0

Related Questions