We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18397
    • 3,250 Posts
    @frère2lacôte: It must be either a corrupt MODx install or a some other snippet as Ditto or my 0.9.2.1 document.parser.inc.php niether has the variable $end or the same contents as you for line 447.

    @yoomai: The only way I can diagnose this further would be to have access to the MODx install you are using. If you would like me to take a look, just PM me with login details.
      • 36451
      • 264 Posts
      The project is still under heavy development and local on my powerbook sad
      Please give me 1 day - it’s almost 7 pm here in Europe. Tomorrow I’ll PM you the login.

      And - thank you.
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        frère2lacôte, check the code of the snippet itself. At the beginning, line 1, it has <?php/**. Get rid of the <?php and you’ll be fine. The "line 447" in the error is referring to the line number in the snippet that is causing the error. That particular error almost always indicates an open <?php tag with no closure. That tag is only put there to make text editors recognize it as a php file and display appropriate color-coding.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 18397
          • 3,250 Posts
          Maybe it has to do with his/her language settings but the error I get if that is true is
          Parse error: parse error, unexpected <? at line 1
            • 10161
            • 31 Posts
            Susan, I removed ALL the lines at the beginning of the sinppet, now it looks like :

            // ---------------------------------------------------
            // Get Language
            // ---------------------------------------------------

            $language = (isset($language))? $language : "english";
            ...
            return $output


            I always get the error.

            I found out the trick : the error is corresponding to the last instruction; the ";" after return $output was missing...

            Thanks a lot for your help
              Qui veut faire quelque chose trouve un moyen. Qui ne veut rien faire trouve une excuse.
              • 4018
              • 1,131 Posts
              Couple of more ideas for ya, Mark! The first one is a snippet I made that simply looks at the template variable values for all published documents in a folder and compiles them as a list of links with a specific URL parameter value. The benefit is that I can create a category list on my page with links that simply pass a URL parameter to the page directing Ditto on how to filter the page. Probably pretty easy to incorporate with some changes to the code. smiley

              // Snippet for creating a list of category links
              
              // ID of folder holding documents to categorize
              $folderid = 6;
              
              // Name of template variable used to hold category names
              $cattv = 'BlogCategories';
              
              // Delimiter used to separate category names
              $catDelimiter = ',';
              
              // Name for URL variable to use in links
              $catvar = 'cat';
              
              // ID of the document used to filter the category
              $filterid = 5;
              
              // Set initial link for displaying all categories
              $catLinks .= "<li><a href=\"[~".$filterid."~]\">All</a></li>";
              
              $allCats = $modx->getDocumentChildrenTVarOutput($folderid,array($cattv),1);
              $countAllCats = count($allCats);
              $arrCatsOutput = array();
              for($p = 0; $p < $countAllCats; $p++){
              	$arrCats = explode($catDelimiter,$allCats[$p]['BlogCategories']);
              	$arrCatsOutput = array_merge($arrCatsOutput, $arrCats);	
              }
              $arrCatsOutput = array_unique($arrCatsOutput);
              sort($arrCatsOutput);
              $countCatsOutput = count($arrCatsOutput);
              for($q = 0; $q < $countCatsOutput; $q++){
              	$catLinks .= "<li><a href=\"[~".$filterid."~]?".$catvar."=".$arrCatsOutput[$q]."\">".$arrCatsOutput[$q]."</a></li>";
              }
              
              return "<ul class=\"categories\">".$catLinks."</ul>";
              


              The last one is simple as hell. All I do is feed it the value of the template variable holding the tags for a given document and it’ll output links for the tags separated by commas. This is great when you want to list what categories a specific post belongs to and allow visitors a quick way of finding similar posts in a given category.

              $tagArray = explode(',', $tags);
              $tagCount = count($tagArray);
              for($t = 0; $t < $tagCount; $t++){	
              	if($t==$tagCount-1){
              		$tagLinks .= "<a href=\"?tag=".$tagArray[$t]."\">".$tagArray[$t]."</a>";		
              	} else {
              		$tagLinks .= "<a href=\"?tag=".$tagArray[$t]."\">".$tagArray[$t]."</a>, ";
              	}
              }
              
              return $tagLinks;
              


              Hope these ideas help! laugh
                Jeff Whitfield

                "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
                • 32963
                • 1,732 Posts
                Nice work on the Ditto snippet Mark.

                Does Ditto support Snippet properties for setting default property settings?
                  xWisdom
                  www.xwisdomhtml.com
                  The fear of the Lord is the beginning of wisdom:
                  MODx Co-Founder - Create and do more with less.
                  • 18397
                  • 3,250 Posts
                  Quote from: xwisdom at Jun 16, 2006, 12:38 PM

                  Nice work on the Ditto snippet Mark.

                  Does Ditto support Snippet properties for setting default property settings?

                  Thanks! I am not sure what you mean. Could you please elaborate?

                  @Jeff, I will simplify both functions you described and add them to Ditto 1.0.2. Can you add this in the Ditto tracker? Thanks.
                    • 4673
                    • 577 Posts
                    I hate to ask this but ...

                    If you are a newbie -- how do you set this up from the beginning?
                    ie, install, sample data, ect ...

                    I even looked into NewsListing but there seems just to be documentation to how to program the code sad
                      Tangent-Warrior smiley
                      • 18397
                      • 3,250 Posts
                      Install and use instructions are in the pdf.