We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36651
    • 3 Posts
    What I have:
    1. some data in database, that represents tree-like structure (dictionaries and words in these dictionaries);
    2. Page with a Snippet that displays dictionaries list;
    3. plugin attached to OnPageNotFound event that parses $_GET['q'] and if query has string like 'dictionary/dictionary_name' forwards it to a Page with Snippet;
    4. Snippet initiated dictionary by 'dictionary_name' and displays words in this dictionary.

    What I want:
    1. I need to change Breadcrumbs, to make them look like 'main > dictionaries > dictionary_name > word'. Now it looks like 'main > dictionaries', because dictionary data isn't modx content type. My idea is to make plugin that attaches to event before rendering Breadcrumbs and add dome data and then it will be rendered with elements I want.

    Question: is it possible and how I can make it?

    This question has been answered by okyanet. See the first response.

    • discuss.answer
      • 33968
      • 863 Posts
      Could you use a variation of your dictionary snippet and do something like this:
      [[breadCrumbs]][[dictionaryCrumbs]]
      

      Where dictionaryCrumbs simply appends > dictionary_name > word to the MODx crumbs?
        • 36651
        • 3 Posts
        Thanks for the reply.

        One of the solutions I thought about was just like yours, but I didn't like the idea of changing existiong templates or chunks. But seems to be, that this is the only solution. My mistake was misunderstanding of modx and Breadcrumbs working. There is no event-toggling before generating Data and rendering html-code for Breadcrumbs, so I can't change Data to change result html.

        That makes your solution the only possible one, afaik. Thanks.