Hi,
I can quite easily retrieve template variables using $modx->getTemplateVar, but how do I save a new value to a template variable in a snippet? I’ve had a search but I can’t find anything.
Thanks,
Michal.
michalc,
What is it that you’re trying to do? There’s more than one way to skin a cat. Maybe if you explain what you’re trying to do there way be an easier, better, or faster way of doing it. So, post what you’re trying to do and be detailed. There are many ’gurus’ here that are more than willing to help when they’re informed. Good luck.
EDIT: I should have been clearer. Why do you need to retrieve that TV and what are you doing with it? I guess I needed to rephrase the question. Yes, you need to retrieve a TV, but what for and why? A good explanation will go a long way in getting a precise answer. Trust me...I learned from experience.
Hi,
Thanks for your responses.
My aim: Allow front end creation/edit/remove of certain documents, with quite a few custom text-fields (one of which is rich text), and each document has an associated uploaded image (but every document doesn’t have to have an image)
I’ve set up (a slightly modified) FDM with an (again slightly modified) Fancy Upload snippet to do this, with the custom text-fields all set up as template variables. Upon upload of the image, I wanted the Fancy Upload snippet to set the location of the uploaded file into the correct template variable for the document.
So far I have found a bit of a workaround: as I only want *one* image associated with each document, I have got Fancy Upload to move the img to [idOfDocument].jpg in a certain location, and I have another short snippet to show the img tag of the only if the file with the correct name exists. However, this is a bit limited and dodgy I think.
Michal.