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

    I want to use Ditto without [+summary+] in the template but to use a TV.
    With the field [+summary+], we cannot use TinyMCE. This is why, I think of using a TV in replacement.

    But if the fields [+summary+] is not indicated, Ditto does not return the values correctly.
    Can one use Ditto without this fields [+summary+]?
    Which are the parameters to do that?
      Marc
      I'm French... Sorry for my bad English, I use ' Google Translator' or other... but that remains that tools wink
      • 21191
      • 236 Posts
      use [+tvTVNAME+] for the TV you want to use. I might be missing something, lost in translation.
        ~Shawn Himmelberger
        Check out my MODx Development and MODx Design Company - Himmelberger Design
        • 18219
        • 826 Posts
        My question requires some additional explanations


        Here the tree structure of my site:
        HomePage
        |- Site 1
        |- Theme 1.1 (folder)
        |-- Document 1.1.1
        |-- Document 1.1.2
        |-- Document 1.1.3
        |-- ...
        |- Theme 2 (folder)
        |-- Document 1.2.1
        |-- Document 1.2.2
        |-- Document 1.2.3
        |-- ...
        |- Theme 3 (folder)
        |-- Document 1.3.1
        |-- Document 1.3.2
        |-- Document 1.3.3
        |-- ...
        ...
        |- Site 2
        |- Theme 2.1 (folder)
        |-- Document 2.1.1
        |-- Document 2.1.2
        |-- Document 2.1.3
        |-- ...
        ...

        In the document “Theme X”, I use Ditto to post the list of the summary.
        Here the code which I use:
        snippet ShowContent
        <?php
        /*
        *  Snippet : ShowContent
        *  Description : Affiche le contenu de la page en fonction dossier parent
        *
        *-- Parametres --
        *  &idPage : id de la page courante
        *  &idTopFolder : id du dossier principal
        *  &field : champ a retourner
        */
        
        // ---------------------------------------------------
        // Parameters
        // ---------------------------------------------------
        
        if (!isset($idPage)) return "No id of page!";
        if (!isset($idTopFolder)) return "No id of principal folder!";
        
        // ---------------------------------------------------
        // ShowSummary
        // ---------------------------------------------------
        $parent = $modx->getParent($idPage,1,'id, pagetitle, longtitle, content');
        if ($parent['id'] == $idTopFolder) {
        	$output ="[!Ditto? &startID=`[*id*]` &summarize=`99` &truncSplit=`true` &truncLen=`9999` &truncText=`En savoir plus...` &sortby=`menuindex` &sortdir=`ASC` &tpl=`ListArticle`!]";
        }
        else {
        	$output ="<h1>[*#longtitle*]</h1>";
        	$output .="[*#content*]";
        }
        return $output;
        ?>
        

        chunk : ListArticle
        <h2>[+title+]</h2>[+tvimagePreview+]
        <div class="resume">
           [+tvlegende+]<br />
           [[HidenLink? &flg=`[+tvotherpage+]` &out=`<!--`]]
           [+link+]
           [[HidenLink? &flg=`[+tvotherpage+]` &out=`-->`]]
        <br />
        </div>
        

        snippet : HidenLink
        <?php
        /* 
        *  Snippet : HidenLink
        *
        * Parametre
        *  &flg : Flag autre page. Si vrai un lien est affich� pour permettre l'affichage du d�tail de l'article sur une autre page 
        *  $out : Type de sortie
        */
        
        $flg = isset($flg)? $flg : "Non";
        $out = isset($out)? $out : "";
        $output = ($flg=="Non")? $out:"";
        
        return $output;
        ?>
        


        and TV : otherpage
        Type: DropDown List Menu with value:Non||Oui

        The TV is to use to indicate the link “En savoir plus...” if necessary.
        If no value is in the field sumarry, the link is not display even if the value of the TV is with “Oui”
        On the other hand, if a value is contained in summary, the link is display.

        I do not understand why I have this result.
        Thank for your ideas.
          Marc
          I&#39;m French... Sorry for my bad English, I use &#39; Google Translator&#39; or other... but that remains that tools wink
          • 25663 MODX Staff
          • 12,272 Posts
          Try the dropdown value set to: Non==Non||Oui==Oui
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 18219
            • 826 Posts
            Thank Ryan but I have a same result.

            In my code, [+tvlegende+] replace [+summary+]. This last field is not used but when I insert a value, the link display.
            I used Ditto v1.0.2

            If used debug, I obtain
            [+tvotherpage+] => Oui
            [+title+] => Theme 1
            [+summary+] =>
            [+link+] =>
            [+author+] => VARLET
            [+date+] => 23-Jan-07 21:42
            tpl = LastRow -> <h2>[+title+]</h2>[+tvimagePreview+] <div class="resume"> [+tvlegende+]<br /> [+link+] <br /> </div>
            
              Marc
              I&#39;m French... Sorry for my bad English, I use &#39; Google Translator&#39; or other... but that remains that tools wink
              • 18219
              • 826 Posts
              It is about a bug of Ditto. Easy to reproduce:

              1 - To create a TV: `resume` (Type RichText)
              2 - Insert to the template :
              [[Ditto? &startID=`[*id*]` &summarize=`99` &truncSplit=`true` &truncLen=`9999` &truncText=`See more...` &sortby=`menuindex` &sortdir=`ASC` &tpl=`ListArticle` &debug=`0`]]
              

              3 - To create a chunk: `ListArticle`
              <h2>[+title+]</h2>
              <div class="resume">
                 [+tvresume+]<br />
                 [+link+]
              <br />
              </div>
              


              If you have a value in the field `summary `, the link ’See more...’ display.
              if not you do not have anything.


              Do you have an idea of this bug?
              How does one announce a official bug on the snippet Ditto?
                Marc
                I&#39;m French... Sorry for my bad English, I use &#39; Google Translator&#39; or other... but that remains that tools wink
                • 18397
                • 3,250 Posts
                [+link+] is ONLY generated when introtext is used in the summary. The correct "link" is [~[+id+]~].

                This is not a bug.
                  • 18219
                  • 826 Posts
                  Thk Mark.

                  I see. I modify my code.
                    Marc
                    I&#39;m French... Sorry for my bad English, I use &#39; Google Translator&#39; or other... but that remains that tools wink