We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27302
    • 154 Posts
    Here’s one I definitely can’t find the solution to. How do I display keywords for the current document? I want to make a Chunk that I can call easily for any page that I want to display keyword links on instead of having to make a Ditto call on each page (hundreds of them) and having to type in the parent or startID manually each time.

    So far I have tried (among many other variations!);
    [[Ditto?id=`[+id+]` &depth=`1` &tagData=`myTags` &tagDelimiter=`, ` &tagDocumentID=`190`]]
    Keywords for this article: [+tagLinks+]
    
      • 4041
      • 788 Posts
      oops...
        xforum
        http://frsbuilders.net (under construction) forum for evolution
        • 27302
        • 154 Posts
        Hi Breezer,

        Thanks very much for your help. It’s very much appreciated. Though I think I should have been more specific (my mind these days gets really muddled up!) When I said keywords I meant to say Ditto page tags. I apologize for any confusion.
          • 4041
          • 788 Posts
          Plus I should have looked at the main topic this thread was posted in may have saved some confusion as well .... pays to look before you leap shocked

          I’ll remove the code so as not to clutter the issue thread and be misleading perhaps to others who may read this... my apologies.
            xforum
            http://frsbuilders.net (under construction) forum for evolution
            • 27302
            • 154 Posts
            I have tried this now;
            [[Ditto?id=`[+id+]` &depth=`1` &tagData=`myTags` &tagDelimiter=`, ` &tpl=`DittoKeywords`]]
            


            And the Chunk "DittoKeywords" as follows
            <div id="keyworddiv">
            Keywords for this article: [+tagLinks+]
            </div>
            


            Now this is displaying keywords, but seems to be displaying them from the documents below the [+id+] document.
            Ie the result is that it displays;
            Keywords for this article: competitive, family, recreational, skillful, tranquil
            Keywords for this article: competitive, family, recreational, skillful, tranquil
            Keywords for this article: competitive, family, recreational, skillful, tranquil

            Whereas I want it to only display tags (tagLinks) based on the tags I have given the document the user is currently viewing so that they can click on a tag and get taken to page id 190 where they will be shown a list of other documents that contain the same keywords.
              • 18397
              • 3,250 Posts
              Instead of &id use &documents=`[*id*]`. Then add &tagDocumentID=`190`
                • 27302
                • 154 Posts
                Hi Mark,

                Just tried that, but received the error;
                « MODx Parse Error »
                MODx encountered the following error while attempting to parse the requested resource:
                « Execution of a query to the database failed - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ’[*id*]) AND sc.published=1 AND sc.deleted=0 ) »
                SQL: SELECT DISTINCT sc.id FROM `db197758221`.`modx_site_content` sc LEFT JOIN `db197758221`.`modx_document_groups` dg on dg.document = sc.id WHERE (sc.id IN ([*id*]) AND sc.published=1 AND sc.deleted=0 ) AND (sc.privateweb=0) GROUP BY sc.id ORDER BY sc.menuindex ASC
                [Copy SQL to ClipBoard]

                Parser timing
                MySQL: 0.0064 s (5 Requests)
                PHP: 0.0827 s
                Total: 0.0891 s
                  • 18397
                  • 3,250 Posts
                  Which version of MODx and Ditto are you using?
                    • 27302
                    • 154 Posts
                    I’m using Modx 0.9.6 and Ditto 2.0.2