Hi all
When Ditto has no results, you can set a text or call a chunck for that with the &noResults parameter.
When there are no results, is it possible to put another Ditto call?
Putting the Ditto call in the noResults parameter itself is no use, cause that call’s parameters will use the ` sign too, which will close the initial &noResults call again. Even when I just put a plain Ditto call ([!Ditto!], without the `-sign), it just shows nothing (not even "[!Ditto!]" as plain text).
I’ve created a chunck with the Ditto call in it, and called that chunck in the &noResults parameter, but then it just shows this Ditto call as plain text on the page.
The last thing I tried was calling a chunck in the &noResults parameter, calling a snippet in that chunck, and then putting the Ditto call in that snippet. Which is pretty useless cause Ditto is a snippet, but i thought "maybe that’ll avoid the call being displayed as plain text.", but no go...
Any ideas?
Thx in advance, and greetings, Kenny
PS: For those who think this sounds useless, "no results means no results, right?", it’s a site with different blogs in sub categories. So showing the latest posts from a category on that category’s main page is no problem, but i want to show this overview on the page of the post itself too (by using the parents Id to start from in the ditto call.
I could just use a different template for the posts themselves, but the problem is that the users (which are primary school teachers) will have to switch from the template that the "post-page" inherited from its parent, to the blog-post template. That’s asking for problems, someone WILL forget to do that SOME time. I want them to just have to write their post in the TineMCE editor.
Ok, I solved it in a different way.
I made a little php script which checks whether the page is a folder or not.
If it is, it displays the pages/posts it containts
if it’s not, it displays the pages/posts of it’s parent (by using the parentId in the ditto call
Grtz, K?!
Ps: should I put [SOLVED] in the title now? because my problem is solved, but it’s not an exact solution to the actual question
I solved this by putting the Ditto call in a custom snippet.
the noResults parameter gets an easy to check value like ’#####’.
[tt]noResults’=>’#####’[/tt]
If there are no results, I launch a different call:
[tt]$result = $modx->runSnippet(’Ditto’, $dittoParams);
if (strpos($result,"#####") !=0) {
$result = "<p>[*id*]</p>" . $modx->runSnippet(’Ditto’, $other_dittoParams);
}[/tt]