Create a folder when writing a new catalog item to the db
Hi
I would like to automate a process: generate a folder dinamically when creating a new catalog item to store entry relevant files (pictures and attachment), the folder would be named based on the timestamp of the item (xxx-Y.m.d) .
I would like to save the item and then have ready the folder to upload the files in it, or copy files located in a temp folder to the relevant folder.
I need it with catalog 2.0 and contao 2.11
I am not sure how to approach this, is there any hook that I could use for, to trigger a custom action when creating o saving the item to the database.
any help is welcome, thanks
Re: Create a folder when writing a new catalog item to the d
Assuming this is happening in the backend; you can extend the DCA. If you add a save_callback to one of the fields you can run your own custom code. The entry you need to add to an existing field looks like this (and you can find examples in most extensions)
Code:
'save_callback' => array
(
array('tl_catalog_items_createdir', 'createUserDir'),
)
tl_catalog_items_createdir is a classname I made up which you have to create in a custom dca file (for example /system/modules/catalog_createdir/dca/ tl_catalog_items.php). This file is the file which you must use to edit the dca.
Re: Create a folder when writing a new catalog item to the d
Clear to me now, many thanks!