Skip to content

Instantly share code, notes, and snippets.

@Finetuned
Created April 10, 2015 13:17
Show Gist options
  • Save Finetuned/840eafd9907008c4b4e3 to your computer and use it in GitHub Desktop.
Save Finetuned/840eafd9907008c4b4e3 to your computer and use it in GitHub Desktop.
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