This question has been answered by rodoneill. See the first response.
<?php
if(isset($_GET['tag'])) {
$tag = strip_tags($_GET['tag']);
$tag = str_replace('-', ' ', $tag);
// get all resources with tag value in their 'articlestags' TV
$articlesContainerId = 3;
$params = array(
'parents' => $articlesContainerId,
'tpl' => 'myArticleListingTemplate',
'showHidden' => 1,
'limit' => 0,
'includeTVs' => 1,
'processTVs' => 1,
'hideContainers' => 1,
'tvFilters' => 'articlestags==%' . $tag . '%'
);
$output = $modx->runSnippet('getResources', $params);
return $output;
}
<IfModule mod_rewrite.c>
# rewrite /tag/tag-name to /tag?tag=tag-name
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^tag/([\w'-]+)$ /tag?tag=$1 [L,QSA]
</IfModule>
[[!GetTaggedArticles]]