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

    This is my first post here, and I’ve been checking out ModX for about a week. I love it, it’s like a swiss army knife of the CMS world.

    I’ve been doing some blog tutorials, and from this, a question arises:

    Instead of using a summery [+summery+] , I wish to use the Content and cut that short in the Chunk. I already tried to see if I could adapt the [+content+] placeholder, but I’ve no idea where to look, or even if I am going about this the right way.

    So, how can I use the content area and truncate it a little? (And when they click on read more... they go to the full page, but this has been no problem to set up)

    I hope I’ve posted this at the right forum section.

    Keep up the great work smiley
      • 18397
      • 3,250 Posts
      If you don’t fill out the "Summary (introtext)" field in the manager, the [+summary+] placeholder will do exactly as you describe. If you are using Ditto 2 refer to the parameters here then append &extenders=`summary` to your call.
        • 22586
        • 74 Posts
        Thanks Ryan for that response, that worked well!;

        For other people with the same problem , in Ditto 2.0.2, this line works:
        [!Ditto? &parents=`15` &display=`3` &tpl=`blogSum` &extenders=`summary` &trunc=`1`!]


        Two things:
        1) Once a document is published, the trunc seemed to be set in stone (it isn’t dynamic) Is it possible to make it dynamic or is there an option to rerender the pages (so if I change the values, it updates) --tried clearing the cache, seem to have no effect.

        2) I want to use "truncAt"
        [!Ditto? &parents=`15` &display=`3` &tpl=`blogSum` &extenders=`summary` &trunc=`1` &truncAt=`<!--endhere-->`!]


        But when I add the tag <!--endhere--> to a new document, it isn’t trunced there.

        Thanks for any help, and I when I am bit more versed in ModX , I shall definitely return the favour in the form of a good ABC tutorial...
          • 18397
          • 3,250 Posts
          MARKSVIRTUALDESK Reply #4, 17 years ago
          1. It is dynamic. You must still be looking at a cached page. Try shift-refreshing in your browser besides emptying the MODx cache.
          2. I’ll take a look and see what is up.
            • 22586
            • 74 Posts
            Thanks for looking into it; To prevent any stupid mistakes on my part, this is my set-up/workflow :

            I tried clearing ModX Cache, deleting history and refreshing. I’ve tried Firefox (my primary browser) and IE7, both it seems the truncation is done only with the rules given at the time of the documents’ creation;

            I do my testing on a local machine (XAMPP).

            I use a page (id=15) as a container, and I use this rule:
            [!Ditto? &parents=`15` &display=`3` &tpl=`blogSum` &extenders=`summary` &trunc=`1` &truncAt=`<!--endintro-->`!]


            Where the blogSum is just a [+title+]
            [+summary+] chunk.

            The reason I wanted to use <!--endintro--> is because the truncation seem to cut off words in the middle, which is unwanted in most cases. I am correct you just place it inside a document where you want the cut off to happen?

            And I add documents by pressing RMB -> create document -> and then add title, text and publish. All in the manager environment.



              • 22586
              • 74 Posts
              After I checked the summary.extender myself, I deleted all mark-up. I am now quite sure there were malformed tags in my documents (some were copied and pasted) After I used tinyMCE’s paste as text code, everything worked as advertised. So one must be cautious with copied and pasted documents! There were too many documents to check what tag or character exactly gave the problems, but there you have it.

                • 18397
                • 3,250 Posts
                MARKSVIRTUALDESK Reply #7, 17 years ago
                Glad to hear things are working!