We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7455
    • 2,204 Posts
    I had an Idea that could maybe work for some. if we could have an outer tpl (like wayfinder has and maxigallery) and a splitter or break tpl than we could populate a table with ditto.

    mabe an option like &break_count=`#` where # is the number of items to process before the breakTpl is placed, and only if there is a 4th document to process.

    the outer tpl could look like this:
    <table><tr>[+Ditto_inner+]</tr></table>
    and the normal, row first etc inner templates could look like this:
    <td>some image tag</td><td> some text</td>
    and the breakTpl something like this:
    </tr><tr>

    so when set &break_count=`3` the ouput wil be this:

    <table><tr>
    <td>some image tag1</td><td> some text from doc 1</td>
    <td>some image tag2</td><td> some text from doc 2</td>
    <td>some image tag3</td><td> some text from doc 3</td>
    </tr><tr>
    <td>some image tag4</td><td> some text from doc 4</td>
    <td>some image tag5</td><td> some text from doc 5</td>
    <td>some image tag6</td><td> some text from doc 6</td>
    </tr><tr>
    <td>some image tag7</td><td> some text from doc 7</td>
    <td>some image tag8</td><td> some text from doc 8</td>
    </tr></table>

    If this is already possible in some way please let me know I could not find any.

    I posted it in the trac here:
    http://mirror3.cvsdude.com/trac/ditto/codebase/ticket/37

    Dimmy
      follow me on twitter: @dimmy01
      • 20765
      • 90 Posts
      myfriendscallmebill Reply #2, 19 years, 6 months ago
      Dimmy, I haven’t tested this but I think it should do what you want:

      (1) Create two TVs, one to hold a URL to an image ("myImageTV") and one to hold the text ("myTextTv").

      (2) Create a chunk to hold a Ditto item template ("dittoItemChunk").  In it place the following template:
      <td>[+myImageTV+]</td><td>[+myTextTv+]</td>


      (3) Construct your document template as follows:
      <table><tr>
      [[Ditto? &tpl=`dittoItemChunk` ]]
      </tr></table>

      (4) If you want to do pagination, place your pagination placeholders (e.g. previous and next) in the document template after the end of the table.

      EDIT: Oops, I didn’t read your post carefully enough. You want three Ditto items per table row, not just one. I imagine that you might be able to put an @EVAL clause in the dittoItemChunk that inserts the row breaks every three items, but that would be way to fragile and complicated for general use.
        • 10357
        • 573 Posts
        You could probably use a definition List and format using CSS to achieve what you are after.


        here’s some good info on DL’s

        http://www.maxdesign.com.au/presentation/definition/
          • 18397
          • 3,250 Posts
          I’ve been avoiding the outer template for some time thinking you could just put it outside the Ditto call and all would be well but I’ve since realized that it’s important if there are no results. Thus, please file an enhancement ticket in TRAC so this can be completed. As for the splitter tpl, that will not officially be implemented as conditional templating will address that in the future. In the meantime, if you need instructions on how to hack that in let me know.