Is there anyway to create a link to a subpage and the only way the link will display, is if there are actually elements for ditto to grab?
In what context? You can use Pagination that will only show if there is children.
Basically what I have is a container with pages that each have images, and ditto grabs each of them. Then also in the container with images I have a sub container. I want to display a link on the topmost page that shows the link to the second container. I don’t actually know if that made any sense. I would post the link, but it is on a password protected dev server.
There is a bunch of approaches!
One TESTED idea:
RESTRICTION: First create all the containers/resources so that their IDs are in nummerical order.
/Planning to add more later - a) create many and publish later or b) just set the math=`...` right
E.g.
Container1 (110)
--Images1 (111)
--Images2 (112)
--Images3 (113)
-Install
GetField
-Now if you have 3 containers - Use in your Ditto Tpl chunk (&tpl=`chunkName`) that is showing Container1, Container2 etc.
[+phx:if=`[[GetField?docid=`[+id:math=`?+1`+]`&field=`TVorDocumenObject`]]`:ne=``:then=`
<a href="[~[+id:math=`?+1`+]~]">[[GetField?docid=`[+id:math=`?+1`+]`&field=`pagetitle`]]</a> |
`:else=``+]
[+phx:if=`[[GetField?docid=`[+id:math=`?+2`+]`&field=`TVorDocumenObject`]]`:ne=``:then=`
<a href="[~[+id:math=`?+2`+]~]">[[GetField?docid=`[+id:math=`?+2`+]`&field=`pagetitle`]]</a> |
`:else=``+]
[+phx:if=`[[GetField?docid=`[+id:math=`?+3`+]`&field=`TVorDocumenObject`]]`:ne=``:then=`
<a href="[~[+id:math=`?+3`+]~]">[[GetField?docid=`[+id:math=`?+3`+]`&field=`pagetitle`]]</a>
`:else=``+]
// Replace TVorDocumenObject with the Element (e.g imageTv01)
This forces you to manually add/tweak things and is only dynamic
to the relation - if empty or not... and if you have Ditto to list many containers
it might be MANY MySQL requests!! Then a snippet or Ditto extender probably
is better.
Ditto filtering is interesting:
http://modxcms.com/forums/index.php/topic,38339.msg231357.html#msg231357
http://modxcms.com/forums/index.php/topic,40005.msg241926.html#msg241926