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

    I’d like to filter out (i.e. NOT display) the current document in ditto’s output.

    I tried this, but maybe I am wrong with the call, as it does not work.

    &filter=`id,[*id*],1`


    Look forward to your valuable suggestions/help.

    regards,

    -Raavi
      • 18397
      • 3,250 Posts
      MARKSVIRTUALDESK Reply #2, 20 years ago
      Try manually inputting the current page’s ID and seeing if that works. Let me know what happens.
        • 24278
        • 165 Posts
        Hi Mark,

        It works, I had made a slight error. Thanks for the help.

        --------------------------------------------------

        I would like to NOT SHOW any document whose ID = $currentID and whose TV ap_bodyID != story. The call below is what I am trying to work with, but somehow it does not work.

        'hiddenTVs'=>"ap_tags,ap_bodyID",
        'filter'=>"id,$currentID,=|tvap_bodyID,story,!=",


        Hope I am doing this right. Also I realised that the filter tag in the documentation states "==" to check for equal to values, whereas in the "ditto.class.inc.php" file the case cheack for "=". Hope I have not misunderstood it.

        best regards,

        -Raavi
          • 18397
          • 3,250 Posts
          MARKSVIRTUALDESK Reply #4, 20 years ago
          You need to use the corresponding #’s and not the symbols as the current parser strips them out. They are there for users calling the snippet via $modx->runSnippet.

          Also, where did you find this in the documentation?
            • 24278
            • 165 Posts
            Hi Mark,

            Please find the image of the documetation with the "==" marked, as an attachment.

            Also, I am calling ditto as under...

            //snippet name: ap_listRelated1
            //snippet call: [[ap_listRelated]]
            //Display related list of stories based on information from TV = "ap_tags" and functionality of ditto snippet call.
            
            //get value of current doc id
            $currentID = $modx->documentObject['id'];
            
            $valueTags = $modx->getTemplateVarOutput('ap_tags', $currentID, 1);
            
            if(isset($valueTags['ap_tags']) && $valueTags['ap_tags'] !='') {
            
            	$snippetName= 'ap_ditto';
            	$snippetParams=array('mode'=>"production",
            			     'startID'=>11,
            	                     'summarize'=>10,
            	                     'hideFolders'=>1,
            	                     'tpl'=>"ap_listRelated",
            	                     'sortBy'=>"pub_date",
            	                     'tagData'=>"tvap_tags",
            	                     'tagDelimiter'=>", ",
            	                     'tags'=>$valueTags['ap_tags'],
            	    		     'hiddenTVs'=>"ap_tags",
            	    		     'filter'=>"id,$currentID,=",
            	                     'emptyText'=>"No related content available at this time.");
            	
            	//initialise $outstring
            	$outstring='';
            
            	//build $outstring
            	$outstring.='<div class="sub-story cf">';
            	$outstring.='<h1 class="t1"><span>Related Content</span></h1>';
            	$outstring.='<ul>';
            	$outstring.=$modx->runSnippet($snippetName, $snippetParams);
            	$outstring.='</ul>';
            	$outstring.='</div> <!-- /relatedOutput -->';
            	$outstring.='<hr />';
            
            	//-- return listing
            	return $outstring;
            }
            else {}
            


            The above code works as expected. But, when I try and add one more TV to the hiddenTVs e.g. ap_bodyID, the code stops to function and returns "No related content available at this time." when there are more related content.

            Actually, I would like to add ap_bodyID to the hiddenTVs and then filter (i.e. show) only documents whose ap_bodyID==story.

            Hope I have been able to explain myself clearly. Please feel free to ask for any more information from my end.
              • 24278
              • 165 Posts
              Hi,

              Can someone please help me out with the above issue. I really can’t figure this thing out.

              -Raavi
                • 24278
                • 165 Posts
                Hi,

                In relation to my code above, I tried a call like this one below, which works as expected...
                [!ap_ditto? &startID=`11` &tpl=`ap_listRelated` &displayArchive=`0` &tagData=`tvap_tags` &tagDelimiter=`, ` &tags=`[*ap_tags*]` &hiddenTVs=`ap_bodyID,ap_tags,ap_thumbnail` &filter=`id,[*id*],2|tvap_bodyID,story,1`!]

                But when I add &mode=`production` it returns "No content available" e.g.
                [!ap_ditto? &mode=`production` &startID=`11` &tpl=`ap_listRelated` &displayArchive=`0` &tagData=`tvap_tags` &tagDelimiter=`, ` &tags=`[*ap_tags*]` &hiddenTVs=`ap_bodyID,ap_tags,ap_thumbnail` &filter=`id,[*id*],2|tvap_bodyID,story,1`!]

                Am I doing something wrong? I am facing difficulties understanding this issue. I really look forward to some guidance with this issue.

                best regards,

                -Raavi
                  • 24278
                  • 165 Posts
                  Hi,

                  Please can someone help me with a solution to the issue above.

                  regards,

                  -Raavi
                    • 18397
                    • 3,250 Posts
                    MARKSVIRTUALDESK Reply #9, 20 years ago
                    Try Ditto 1.1 Beta 1 as it should solve some of the problems you are having.
                      • 24278
                      • 165 Posts
                      Thanks mark,

                      Will try it out. Thanks a ton for this great tool.

                      best regards,

                      -Raavi