@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.
-
☆ 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.
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
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.
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.
// 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!
Jeff Whitfield
"I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
Nice work on the Ditto snippet Mark.
Does Ditto support Snippet properties for setting default property settings?
Install and use instructions are in the pdf.