We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 49635
    • 63 Posts
    Hello!

    I use your CMS and ran into a problem

    It is impossible to separate the parent to deduce content to the page, all content is displayed in full on all pages

    Level structure:

    level 1
    --level 2
    level 1
    --level 2
    --level 2
    --level 2
    --level 2

    level 1
    --level 2



    small code:
    [[Ditto? [u]&parents=`[*parent*]`[/u] &id=`portfolio-content` &depth=`1` &tpl=`portfolio-content`]]
    


    This code displays the entire contents of the pages, but it is necessary for each page of your
      • 2762
      • 1,198 Posts
      Please, post your "portfolio-content" tpl

      Do you use "[+summary+]" or "[+introtext+]" ?
        Free MODx Graphic resources and Templates www.tattoocms.it
        -----------------------------------------------------

        MODx IT  www.modx.it
        -----------------------------------------------------

        bubuna.com - Web & Multimedia Design
        • 49635
        • 63 Posts
        Quote from: banzai at Jan 08, 2015, 01:19 AM
        Please, post your "portfolio-content" tpl

        Do you use "[+summary+]" or "[+introtext+]" ?


        No, I bring the standard content
        [+content+]

        But modx displays all the articles at
          • 13226
          • 953 Posts
          Just to ensure there is no misunderstanding:

          What I understand is you have a main page (parent - level 1) that pulls in content from other pages (child pages - level 2) - similar to a blog overview page, where it shows excerpts of its child pages content.

          I presume your main page (parent) has the following in it:
          [[Ditto? &parents=`[*parent*]` &id=`portfolio-content` &depth=`1` &tpl=`portfolio-content`]]

          What I don't understand here is the:
          &parents=`[*parent*]`

          I don't think that works - I may be wrong. I was under the impression that the following is used as it designates (in this situation) its own ID:
          &parents=`[*id*]`

          Side tracked there, sorry

          If you are calling "[+content+]" in your "portfolio-content" template you will always output all of the contents of the main content box / area of that page.

          If you only want a part of the content you need to cut the amount of characters down and you will need to strip the HTML tags as well.

          You can use Ditto's built in PHX functions to do that:

          Create 2 new snippets:

          phx:striptags
          <?php
          return($modx->stripTags($output, $options));
          ?>

          phx:word_limit
          <?php
          $retval = $output;
          $array = explode(" ", $output);
          if (count($array)<=$options)
          	 {
          	 $retval = $output;
          	 }
            else
          	 {
          	 array_splice($array,$options);
          	 $retval = implode(" ", $array);
          	 }
          return $retval;
          ?>

          This is just a guess, so if it's wrong you will have to modify as required:

          In your "portfolio-content" template, change "[+content+]" to this:
          [+content:word_limit=`50`:striptags+]


          The new call delimits the snippets using ":" therefor both snippet calls are added in one. [ed. note: iusemodx last edited this post 9 years, 3 months ago.]
            • 49635
            • 63 Posts
            Hello!
            Thx for help!

            Yes on `[*id*]` implementation will be true, because the content is displayed in the right place for everyone.
            But this realization brings a null value, on the other hand, when the realization comes with the `[*parent*]`, the output unit without any problems.

            Thanks for the snippet length restrictions conclusions content, it may be useful to someone. I need to display all the content


            Now I have applied to the conclusion the `[*id*]` and the conclusion was not the parent content, and all the subsidiaries blocks

            Tree when using &parents=`[*id*]`:

            Level 1 ---- not show
            ----Level 2 ----- show
            ----Level 2 ----- show

            Level 1 ---- not show

            ----Level 2 ----- show
            ----Level 2 ----- show

            But needed:

            Level 1 ---- show (only one this page)
            ----Level 2 ----- not show
            ----Level 2 ----- not show

            Level 1 ---- show (only one this page)

            ----Level 2 ----- not show
            ----Level 2 ----- not show

            Above example works with &parents=`[*parent*]`, but i see all content list on one page:
            level 1 ([id = 1]),
            level 1 ([id = 3]),
            level 1 ([id = 5]),...
            [ed. note: almag13 last edited this post 9 years, 3 months ago.]
              • 13226
              • 953 Posts
              I am getting lost and confused - I think the language barrier is making things more complicated.

              You want the content of level 2 to be shown on level 1 - but the content shouldn't show on the level 2 pages ?

              And you only want to show the content of level 2 on level 1 on a per page basis ?

              Well confusing

              Do you have an example anywhere ?


              If you don't want level 2 to be shown unpublish them and change the Ditto call by adding: "&showPublishedOnly"
              &showPublishedOnly=`0`

              I don't know if this will help but you can also pre-define specific document(s) to be shown using: "&documents"
              &documents=`1,2,3,4,5,6`


              This post may or may not help, as I am not sure I fully understand your requirements. [ed. note: iusemodx last edited this post 9 years, 3 months ago.]
                • 49635
                • 63 Posts
                default
                I create a page in another page which exist

                Content is present as the parent page and on the inner. To display the same pattern is used for these pages.

                Now the following happens all the content displayed on the same page, so it should be, but in different places you want to display internal pages and parent
                  • 49635
                  • 63 Posts
                  This example:

                  First level have content

                  http://joxi.ru/J2beBBJFXN0om6

                  the second level is similar, but has its content

                    • 49635
                    • 63 Posts
                    Hello my friends!

                    it was much easier
                    did not need to withdraw this part through Ditto was enough to specify a template that we derive the content: [*content*]

                    Thx for help
                    topic can be closed