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

    I already wrote a post in the General Support Forum, but no response till now.
    Maybe I can get more help with a detailed description and a half "solution" in the right forum? grin

    Ok let me explain my problem.
    The site I’m building has 4 major sections/categories. Lets say for example the website for a
    Car Manufacturer with 4 categories like Models, Engines, Tires, Accessories.
    Every category is like a little own website with a different templates and its own dropmenu configuration.

    I have a News section for all four categories together. Every category has a folder ’News’ where I have used
    ’Ditto’ to show the associated news. I managed a filtered (tags) output by Ditto with a TV (Multiple Checkboxes)
    where I can define per each message in which category the message should be published.

    -Site Root
    |
    |-Models (Template 1)
    | |-News (Snippet ’Ditto’ output filtered by tvTag defined in News message)
    | |-Model 1
    | |-Model 2
    | |-Model ...
    |
    |-Engines (Template 2)
    | |-News (Snippet ’Ditto’ output filtered by tvTag defined in News message)
    | |-Engine 1
    | |-Engine 2
    | |-Engine ...
    |
    |-...
    |
    |-News
    |-News Article 1 (To be published in = ’Models,Engines’)
    |-News Article 2 (To be published in = ’Engines’)
    |...

    The overview output with Ditto in its respective category works wonderful. But when I click on ’more text’ for the
    detailed view of the message, I need to assign the specific template for the output, based on the category I’m
    coming from.

    I already played a little bit with the Template Switcher Plugin from Susan, and I think this could work.
    I think my/the solution is to define in Ditto with which template the detailed page should be called ...

    Let me be honest - I’m no programer/coder. I can "read" the code and understand a little how it works, I think ... smiley
    but I could need some help doing this.

    I’m happy about any help or hint how to manage this.


      • 18397
      • 3,250 Posts
      Why could you not set the template for each document in the manager?
        • 1549
        • 20 Posts
        TV’s don’t work when added to ditto.

        I have a picture tv ( it works on the full article ). And I put it in my ditto tpl chunk, but the darn thing just does not work ( in my source I get a img tag but with no url specified - and i specified the url ). I even tried a simpler TV ( just textbox TV ) and it does not work too.

        Any solutions?
          • 6726
          • 7,075 Posts
          Yes they do. Indeed they work pretty well with Ditto and that’s the real power of Ditto IMHO.

          I think you came to that conclusion because TVs are hard to grasp at first... when I started using TVs I got the same misconception : Image TVs do not contain (and render) the image but the path to the image on the server.

          For the image to appear as intended just use something like this :

          In chunk tpl
          <img src="[+tvmy_image_tv+]" alt="[+tvsome_tv_used_as_alt_text+]" class="myclass"/>

          (note the tv prefix)

          On detail page
          <img src="[*my_image_tv*]" alt="[*some_tv_used_as_alt_text*]" class="myclass"/>


          (the detail page is controlled by the template used for your document)
            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l&#39;outil id
            • 3758
            • 17 Posts
            Mark,

            thanks for your help.

            Why could you not set the template for each document in the manager?
            I know, that would’t be a problem if the single message is only publish in one categroy.
            But in my case one message can also be seen in two or maybe in all categories at the same time.

            |-News
            |-News Article 1 (To be published in = ’Models,Engines’)
            |-News Article 2 (To be published in = ’Engines’)
            |...
            So if for ’Models’ is a green background defined and for ’Engines’ a blue one, I could only assign one color by the manager.

            I don’t know, maybe there is another solution which I can’t see at this moment ... huh
              • 18397
              • 3,250 Posts
              Ah, now I see your dillema.

              It would not be difficult to solve (a short php script would do the trick). Here are some pointers:

              Create an assosiative array with ["tag"] = "templateID";

              This would allow you to say if "tag" is a key in the array then append its "?template=TEMPLATEID" to the url of the output of Ditto and if not do not append anything.

              So, you would put (assuming you have FURLS on) [~[+id+]~][!yoursnippet!] in your template and have the template switcher plugin installed to dynamically swap page templates.

              Note: Your pages will need to be uncached and your Ditto calls cached for this to work.
                • 3758
                • 17 Posts
                Mark,

                thanks for your great advice.
                I got a bit distracted since my son was born two weeks ago grin

                But that should be no excuse, my problem is that I understand what you mean but I don’t know how to do this.
                To tell the truth I don’t know where to start with this. If you could tell where and what to do, I’ll try my best laugh

                So long,
                Boris
                • Congrats Boris! You’ll not have any sleep for the next 4 months, but children are a huge blessing!
                    Ryan Thrash, MODX Co-Founder
                    Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                    • 3758
                    • 17 Posts
                    OK Guys, I’ve solved the problem by myself! Without without changing a line! grin
                    I installed the "Template Switcher" Plug-in and created 4 different chunks for each output.
                    In every single chunk I modified the links to use the right template. wink

                    Ditto:
                    [[Ditto? &startID=`79` &hiddenTVs=`Aktuelles` &tagDelimiter=`,` &tagData=`tvAktuelles` &tags=`Engine` &tpl=`Engines` &sortBy=`createdon`]]
                    


                    Chunk:
                    <div class="ditto_summaryPost">
                      <span class="date">[+date+]</span><br />
                      <span class="subline">[+title+]</span>
                      <div>[+summary+]</div>
                      <a href="[~[+id+]~]&template=DE_DK_Main_Tpl">weiter...</a>
                    </div>
                    


                    The easiest way is always the hardest to find!

                    Anyway thanks for your help!