-
- 24,544 Posts
As you say, there may already be a snippet for this (I don’t know of one).
If not, you could probably write one based on the getChildIds() code and only add IDs to the array if isfolder is set.
http://wiki.modxcms.com/index.php/API:getChildIds
-
- 2,314 Posts
thanks Bob, i’ll look into that
-
- 24,544 Posts
I think it’s because you’re returning an array and the parameter should be a comma-delimited list.
Try this:
return implode( ',',$folderids);
-
- 24,544 Posts
Quote from: sharkbait at Jun 06, 2010, 06:21 AM
Hi Bob,
thanks
is already returning a comma separated list.
btw. i found out, that if i use that Snippet within the other one ( link above) to return the parent IDs, i need to "print" the result instead of "return" ...then it works
Duh. Of course it is.
About "print"ing the results. That’s weird, I would have expected the opposite.
-
- 788 Posts
"print" should be used, too if the Snippet is included as an external file
FWIW,I like to use the following setup and it normally works pretty well.
Test snippet code
<?php
$output ='';
include MODX_BASE_PATH.'assets/snippets/testsnippet/test_processor.php';
return $output;
?>
test_processor.php file contents
<?php
defined('IN_PARSER_MODE') or die('<b>UNAUTHORIZED_ACCESS_ERROR</b>');
// add whatever you want to the $output
$output .='<p>Just a test message</p>';
?>
:)