Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MODX Plugin: Named Anchor with Parameters
<?php
if ( $modx->resource->get('id') !=$modx->config['site_start'] ) {
$params = '';
if (count($_GET) > 1 ){
$arr = $_GET;
array_shift($arr);
$params = '?'. urldecode(http_build_query($arr, "\n"));
}
$url = $modx->makeUrl($modx->resource->get('id')) . $params . '#';
$modx->resource->_output = str_replace('href="#','href="' .$url ,$modx->resource->_output);
unset($arr);
unset($params);
unset($url);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment