Hi,
I’m trying to make a plugin that creates a directory named after the document id. So i attach my plugin on the OnDocFormSave event and
this is my code.
$d = $modx->documentObject[’id’];
system("mkdir /home/1471/domains/deloudis.gr/html/assets/images/ImageLib/".$d);
echo $d;
the problem is that i dont get a return value from $modx->documentObject[’id’];
Am i doing something wrong?
Alex.
Ok so any suggestions? how can i find the properties of the document im editing in order to use them in my plugin as i described?
Ahh yes!
Thanks man you saved me. Do you know if the variables initialized in mutate_content.dynamic.php affect my plugin (onSaveForm etc?); Meaning can i find in my plugin the parent, or top document of my current document? the one im editing ? mutate_content.dynamic.php seems to know it.will it pass in my plugin?
As the doc has been saved in db you should access every properties of the new document easily by using modx API.
:-)
Here is what im after: I need to create document->n relations in documents. Each document is a piece of furniture, each one having n images. So what i wanted to do is to automatically create a folder named after the document’s id.But not for all documents, just the one belonging to a specific parent folder i.e Furniture.
So i need to know the document’s parent to decide if i must create the folder. My plugin executes OnDocFormSave. Is this after the document has been saved? or exactly before? If its after its ok i guess i can use the Db Api to find what i want.
I will also need to create my type of Tv to create multi relations.
The onDocFormSave happens after the doc has been saved.
The $id comes from mysql_insert_id().
:-)