Hi,
I want to be able to split the ditto results in to two columns.
Down the left column i’m going to have news articles summary and in the right i will display the full content of one article at a time. This will change when the user clicks "more" from an article on the left. I can achieve the content changing in the right column by using jquery but what i’m not sure about is the best way to split the results i’m getting from the ditto call. I’ve read through the forums and the best i can find is doing 2 ditto calls. First one calls the title summery and url link ect. And the second call just displays the content.
Does it sound the best way to achieve this, is to have two ditto calls, or is there an better way to do this.
Many Thanks
Ben
Ben
I guess you could use .CSS to hide all the other articles in the right column, but I think 2 Ditto calls would be a lot more efficient and much easier to implement.
Two Ditto calls adds unnecessary overhead.
You can easily use jQuery to manipulate the dom and split the results into two columns as you describe, and this is the approach I would take since it makes semantic sense to have the headlines and summary text outputted in a linear order: it makes it accessible to screen readers and search engine friendly.
However, you could also write your own snippet and run Ditto with $modx->runSnippet() - the Ditto save parameter can be used to save the resultset as a placeholder, which you can then iterate through and format as you wish.
Quote from: dev_cw at Aug 11, 2008, 06:09 AM
2 Ditto calls will work.
If you are displaying only one article at a time you could you could use a simpler snippet to retrieve the data like GetField. Or you can do it programmaticaly through the api with modx->runSnippet()
If you know the document ID, this snippet should get the content and display it with minimal overhead:
echo $modx->getDocument($id, 'content');
Thanks for all you replies. So guess a few ways to do it. Got it working fine with 2 ditto calls. But i’m going to look at some of the other options as well, always good to try all possibilities.
Many Thanks
Ben