-
☆ A M B ☆
- 24,524 Posts
TVs don’t play well with nested TVs; it’s how the parser processes them. If this is to produce a list of items for the front-end, you can use a snippet to get the TV value and generate the list.
I’m trying to generate a multi-select-list with images for a slideshow. The path to the images should be the same like the ressource-alias.
I created the nippet now and wrote the snippet call ( [[SlideshowPath]] ) into the TV. But that doesn’t work too.
-
☆ A M B ☆
- 24,524 Posts
Well, you would have to edit each resource that is using this TV and edit its copy of the TV to have the alias hard-coded.
My intention was to use a snippet instead of a TV. With $modx->documentObject[’alias’] to get the page’s alias, then PHP code to generate the list from the files in the directory.
With this solution isnt’t it possible for the admin to select the images per select-box, right?
you can try this:
@EVAL $doc = $modx->getPageInfo($_REQUEST['id'], 0, 'alias');return '@DIRECTORYassets/images/slideshows/'.$doc['alias'];
try this:
@EVAL $doc = $modx->getPageInfo($_REQUEST['id'], 0, 'alias');$path='assets/images/slideshows/';return (is_dir($modx->config['base_path'].$path.$doc['alias'].'/'))?'@DIRECTORY'.$path.$doc['alias']:'@DIRECTORY'.$path;