We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 630
    • 39 Posts
    Hi,

    I am elaborating a tagging system for my website, that shall be more powerful and comfortable than what I get from the MODx resources repository. I intend to publish it when finished, so that everybody can benefit. But I’m stuck in trying to make the tagging system and Ditto cooperate properly, would you help me, please?

    One core characteristic of my tagging system is that the tag is per se (i.e. what is saved in database at the end) just the document id of the respective category page. That alone should not make relevant differences to "literal" tagging approaches, should it?

    So, on the category page I just place a Ditto-call that is supposed to retrieve all documents, the template variable ’tags’ (comma-separated list) of which contains the id of the category page.

    case 'menu': /*
     * use Ditto for making a menu list to all documents with the tag(s) passed
     */
    
    $dittoptions = array();
    
    $dittoptions['extenders'] = 'tagging,summary';
    $dittoptions['truncLen'] = 150;
    $dittoptions['truncText'] = '???';
    $dittoptions['tagData'] = 'tvtags';
    $dittoptions['tagMode'] = 'onlyTags';
    $dittoptions['tagDelimiter'] = ',';
    $dittoptions['debug'] = 0; # whyever debugging doesn't work
    $dittoptions['noResults'] = '<p class="weak">Dokumente: —</p>';
    $dittoptions['tpl'] = '@CODE:<li><h3>[+title+]</h3><p>[+summary+] [+link+]</p></li>';
    $dittoptions['tags'] = $modx->documentIdentifier;
    
    return $modx->runSnippet('Ditto', $dittoptions);
    


    The snippet running this piece of code is called this way in the template:
    [*taggongMode:anyof=`1,3`:then=`[!TaggoNG? &do=`menu`!]`*]

    In the database, the ’tags’ content is kind of ’37||12|56||...’, but what I get with the aid of $modx->getTemplateVarOutput is ’37,12,56,...’ - just as I expected.

    But it does not work. Category pages always yield "Dokumente: &mdash;".

    Did I miss something? Please tell me.

    And tell me also when I reinvent the wheel as such a tagging system already exists wink. A retrieval can never be really complete.

    Thank you,
    agilero.
      • 630
      • 39 Posts
      The longer it takes to a solution, the easier it is (or vice versa). I simply missed to set the parameters ’parents’, in my case to the parent id of the current id, plus also depth to 0, i.e. infinite depth. Oh, I guess I did not explain my problem quite well, otherwise you would have given me a hint that easy for sure. I should try to make the snippet documentation more comprehensible.

      Thanks,
      agilero.