We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5091
    • 332 Posts
    I know what I wanted to achieve is doable with ditto, but I can’t wrap my head around it.

    This is what I want to do: to filter out a very long list of addresses by cities, states with list format
    <ul class="listing">
    <li>name1</li>
    <li>address1</li>

    <li>name2</li>
    <li>address2</li>
    </ul>

    what I want to present is, with a list of city names like so as tag cloud: Berkeley, New York, Albany, Oakland, San Jose....
    when a city is clicked, take Berkeley for example, it output a list of addresses for Berkeley only. I don’t particularly want a landing page, but can live with it if that is the only way to achieve.

    Note that these addresses do not appear in other parts of the site, that means it’s not a search function I am after.

    Can you kindly point me to a direction with the below Ditto call as to what other favors are needed to make it happens. I was thinking I need to add filter, depth and sortby parameters, and create extra chunks for ditto templates. I was thinking a chunk that contains all addresses is enough for ditto to call and filter out but I don’t seem able to get it working.

    This is the call I have right now.
    [[Ditto? &parents=`16` &summarize=`16` &total=`20` &tpl=`storeList` &tagDelimiter=`, ` &tagData=`myTags` ]]

    The ’&summarize=`16`’ is not needed correct? and the ’&total’ value should be increased

    Thanks!

    tgp
      • 5091
      • 332 Posts
      Nobody can help me??

      I am getting so close, I need a pointer or two... I feel this is a threshold that is holding me back to finally ’make sense’ how Ditto works.

      tgp
        • 10449
        • 956 Posts
        well... how is the data stored? one doc per address? are the address-elements stored in template variables (e.g. name, street, zip, city)? Or do you keep all these addresses in one single doc? As long as we don’t know about that, we can’t really make any helpful suggestions...
          • 5091
          • 332 Posts
          Quote from: ganeshXL at Aug 18, 2007, 07:51 AM

          well... how is the data stored? one doc per address? are the address-elements stored in template variables (e.g. name, street, zip, city)? Or do you keep all these addresses in one single doc? As long as we don’t know about that, we can’t really make any helpful suggestions...

          Thanks for the response.

          This is the problem: I have no clue how the data should be stored - I thought of how it should be but I have not been able to get it working by following the Ditto tagLinks toutorial from Wiki, and the tagging screen cast tutorial, I can’t put the whole picture together. Bascially what I wanted is something similar to the Modx’s resource tag cloud and when a tag is clicked, it brings up the results in the same page, something similar to the css beauty tags:
          http://www.cssbeauty.com/cgi-bin/mt/tags.cgi?tags=clean

          http://www.modxcms.com/repository-tag-cloud.html,

          I know I need a Tv template, a chunk, or maybe categories to store addresses grouped by city or state (but this seems pointless as by doing so I can just create different documents, say, all addresses located in Berkeley in one document, another group of addresses located in New York in another document, then manually create links. I don’t want this.)

          Currently all addresses (business listings) are in the same document (ID#3) with list formating like so and there are some 150 of them:

          <ul class="listing">
          <li>123 peace land</li>
          <li>Berkeley, CA 94701</li>

          <li>123 Freedom Ave</li>
          <li>New York 10001</li>
          </ul>

          thanks

          tgp
            • 10449
            • 956 Posts
            Well, if you want all addresses in one single doc, it simply won’t work.

            The key to being able to filter out data - any data - is structure. What you have now, is the opposite of that. It’s just a bunch of text.

            You could either store the addresses in a separate database-table and use a few custom lines of php to output a list in one single document OR use one modx doc per address in conjunction with TVs, and Ditto to filter out certain addresses according to TV values.

            I think you should really read up on basics here: A database or scripting language can’t just automagically guess what you are trying to find. That’s not really MODx’s fault, it’s just the way things work. Look at any address-book type of web-app: You won’t see all items thrown into one big data-field. How is PHP (or MODx) to know which <li> item stands for street, ZIP, state or city? Where does one dataset (record) begin, and where does it end?
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Unless you want to write a snippet that parses the document, and sucks up blocks of 3 or 4 <ul></ul> tags. You’d be better off using an XML document and parse it properly if you’re going to do it that way. Actually, that’s what XML is for.

              http://il2.php.net/manual/en/ref.xml.php
              http://il.php.net/simplexml (php 5 only)


              There are a few nice libraries for working with this...

              http://sourceforge.net/projects/phpxpath/
              http://evan.wordpress.com/2006/01/17/cxml-a-fast-dependentless-xml-library-for-php/
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 5091
                • 332 Posts
                Thanks both for the pointers.

                sottwell, thanks for the links of simple XML. Will see how far I can go with this approach.

                tgp