Hi there everyone.
I'm developing a site for a company with multiple office locations. Something like this (simplified site-map)
Locations
....London
........page 1
........page 2
....Liverpool
........liverpool sub page 1
........liverpool sub page 2
....Manchester
........manc sub page
There will be users for each location, with permission to make changes for their own location only.
I want each location to have it's own folder of images. File structure looks like this:
/locations
/locations/london
/locations/liverpool
/locations/manchester
All the location pages will use the same template. So how can I specify an image template variable to use the correct media source when the same template is used across all pages?
Hope I've made sense, as you may tell, I am a complete novice with modx. I'm picking it up quite well, but this has stumped me.
Jay.
@letsallplaygolf
you can add a snippet-call to mediasource-pathes like that example:
assets/images/[[getUserID]]/
the example-snippet getUserID:
if (is_object($modx->resource)){
$createdby = $modx->resource->get('createdby');
//at frontend or if created resource is active, return createdby
if (!empty($createdby)){
return $createdby;
}
}
// else (backend) return userid
return $modx->user->get('id');
this example works with the createdby-field if it exists on a resource or the userid.
This needs to be modified for your needs.