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

    So I’ve manage to work out how to get a blog style list of summary’s using a couple of chunks and...

    [!Ditto? &tpl=`blog` &summarize=`10` &paginate=`1` &sortBy=`pub_date` &sortDir=`DESC` &paginateAlwaysShowLinks=`1` &tplLast=`paginate`!]

    What I can’t work out is that once you click through to an individual article, how do you define what appears in that template? I can only think of doing it with another page template but I don’t want the admin user to have to update the default template every time the write a news item.

    Any ideas/insights welcome.

    Cheers.
      • 3749
      • 24,544 Posts
      I’m not sure I understand your question. It sounds like you want the individual articles to have their own template that’s different from the main site template. I’m assuming that all the individual articles could share the same template.

      If your blog article documents are all in (below) a container document, you can create a new blog article template and assign it to that container document. Then, any new posts created under that container will inherit that template rather than the site’s default template.

      Hope that makes sense.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 31393
        • 6 Posts
        Yeah you’ve got the idea. The problem with the method you describe is that I don’t want the individual document templates to be the same as the container template. At container level I just want to output [*content*] which contains the ditto call and at document level I want the title, date and author and content of the individual article.

        The only way around this I can think of is to add some sort of logic; if you’re at container level process Ditto, else if you’re in a child document output X chunk.

        huh
          • 3749
          • 24,544 Posts
          Quote from: velocity at Nov 21, 2008, 04:13 AM

          Yeah you’ve got the idea. The problem with the method you describe is that I don’t want the individual document templates to be the same as the container template. At container level I just want to output [*content*] which contains the ditto call and at document level I want the title, date and author and content of the individual article.

          The only way around this I can think of is to add some sort of logic; if you’re at container level process Ditto, else if you’re in a child document output X chunk.

          huh

          I see your problem. It might be cleaner to just create a plugin triggered by saving a document that checks to see if the parent is the container and, if so, changes the template to the one you want. Someone else may suggest an easier way, but that’s all I can think of at the moment.

          You could just put the documents in a different container altogether (Ditto would still find them), but it would probably mess up your menus.

            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 34193
            • 330 Posts
            Quote from: BobRay at Nov 21, 2008, 04:54 PM


            You could just put the documents in a different container altogether (Ditto would still find them), but it would probably mess up your menus.

            This should work if you don’t want the posts to appear in your menus (i.e only appear on the ditto page) as you could just then deselect don’t show in menu of the post container.

            Then it and all posts would not appear in menu but ditto could still find and use the posts
              • 7231
              • 4,205 Posts
              You could use a snippet to do some logic and display one output if container and another if not. I have done this before, the isfolder parameter makes it easy to identify if the document is a container. Then you can either load a chunk or simply process the output directly in the snippet.

              Another option is to use 2 templates and use a plugin to determine that the children use template x. I have done this as well and there are a few plugins available that allow you to predetermine templates by parent.
                [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                Something is happening here, but you don't know what it is.
                Do you, Mr. Jones? - [bob dylan]