<![CDATA[ [Plugin] AnchorsAway - My Forums]]> https://forums.modx.com/thread/?thread=35800 <![CDATA[Re: [Plugin] AnchorsAway]]> https://forums.modx.com/thread/35800/plugin-anchorsaway?page=3#dis-post-480487 Quote from: heliotrope at Jul 19, 2007, 08:00 AM
Hi,

This one will work without changing the start id page in the plugin code


<!--?php
$e= & $modx--->Event;
switch ($e->name) {
    case "OnWebPagePrerender" :
        if($modx->documentIdentifier != $modx->config['site_start']) {
            $modx->documentOutput= str_replace('href="#', 'href="' . $modx->makeUrl($modx->documentIdentifier) . '#', $modx->documentOutput);
        }
        break;
}
?>


:-)
Thanks man.

It works perfect. My menu used # links, and this plugin solved the problem]]>
kashelobaga Oct 17, 2013, 09:03 AM https://forums.modx.com/thread/35800/plugin-anchorsaway?page=3#dis-post-480487
<![CDATA[Re: [Plugin] AnchorsAway]]> https://forums.modx.com/thread/35800/plugin-anchorsaway?page=3#dis-post-475468 Everettg_99 Aug 20, 2013, 10:22 PM https://forums.modx.com/thread/35800/plugin-anchorsaway?page=3#dis-post-475468 <![CDATA[Re: [Plugin] AnchorsAway]]> https://forums.modx.com/thread/35800/plugin-anchorsaway?page=3#dis-post-414997
In Evolution 1.0.5 the plugin can cause a parse error if the site status is set to "offline" and the "Site unavailable page" is blank... ie: you are using the "Site unavailable message" field.

The error:
`` is not numeric and may not be passed to makeUrl()

This seems to fix it:

$e= & $modx->Event;
switch ($e->name) {
    case "OnWebPagePrerender" :
        if($modx->documentIdentifier != $modx->config['site_start'] && !empty($modx->documentIdentifier)) {
            $modx->documentOutput= str_replace('href="#', 'href="' . $modx->makeUrl($modx->documentIdentifier) . '#', $modx->documentOutput);
        }
        break;
}


G]]>
gerardL Mar 06, 2012, 11:19 AM https://forums.modx.com/thread/35800/plugin-anchorsaway?page=3#dis-post-414997
<![CDATA[Re: [Plugin] AnchorsAway]]> https://forums.modx.com/thread/35800/plugin-anchorsaway?page=3#dis-post-199475
if($modx->resource->get('id') != $modx->config['site_start']) {
  $modx->resource->_output = str_replace('href="#', 'href="' . $modx->makeUrl($modx->resource->get('id')) . '#', $modx->resource->_output);
}
]]>
ninjapirate Aug 09, 2011, 06:07 AM https://forums.modx.com/thread/35800/plugin-anchorsaway?page=3#dis-post-199475
<![CDATA[Re: [Plugin] AnchorsAway]]> https://forums.modx.com/thread/35800/plugin-anchorsaway?page=3#dis-post-199474
<base href="[(site_url)][~[*id*]~]" />


to the <head> of their templates (Evolution)]]>
Marturion Feb 02, 2011, 02:19 PM https://forums.modx.com/thread/35800/plugin-anchorsaway?page=3#dis-post-199474
<![CDATA[Re: [Plugin] AnchorsAway]]> https://forums.modx.com/thread/35800/plugin-anchorsaway?page=3#dis-post-199473 MarkMitchell Nov 05, 2010, 05:53 PM https://forums.modx.com/thread/35800/plugin-anchorsaway?page=3#dis-post-199473 <![CDATA[Re: [Plugin] AnchorsAway]]> https://forums.modx.com/thread/35800/plugin-anchorsaway?page=3#dis-post-199472
The links are being built <a href="[~1~]#anchor">Link</a>. When you click on "link" the anchor becomes the top of the page, and you can’t scroll up, basically chopping off the top half of the page (or anything above the anchor).

Am I missing something in the implementation of this plug-in? I copied:
$e= & $modx->Event;
switch ($e->name) {
case "OnWebPagePrerender" :
if($modx->documentIdentifier != $modx->config[’site_start’]) {
$modx->documentOutput= str_replace(’href="#’, ’href="’ . $_SERVER[’REQUEST_URI’] . ’#’, $modx->documentOutput);
}
break;
}

Into a new plug-in I called AnchorsAway, and checked OnWebPagePrerender.

What am I missing?]]>
golds30 Jan 28, 2010, 04:09 PM https://forums.modx.com/thread/35800/plugin-anchorsaway?page=3#dis-post-199472
<![CDATA[Re: [Plugin] AnchorsAway]]> https://forums.modx.com/thread/35800/plugin-anchorsaway?page=2#dis-post-199471 Hi everyone, I’m a newbie to modx and have looked all around to find where I should write this piece of code. Did I overlook anything?
I got to this topic as was trying to find a solution to my jQuery accordion that stoped working under modx (still haven’t solved it).
Thanks in advance.]]>
adsoncristian Aug 18, 2009, 04:13 PM https://forums.modx.com/thread/35800/plugin-anchorsaway?page=2#dis-post-199471
<![CDATA[Re: [Plugin] AnchorsAway]]> https://forums.modx.com/thread/35800/plugin-anchorsaway?page=2#dis-post-199470 lastoftheromans Jul 16, 2009, 12:42 AM https://forums.modx.com/thread/35800/plugin-anchorsaway?page=2#dis-post-199470 <![CDATA[Re: [Plugin] AnchorsAway]]> https://forums.modx.com/thread/35800/plugin-anchorsaway?page=2#dis-post-199469 Quote from: Pete at Jun 17, 2009, 02:23 PM

This is a very useful bit of code.

Silly question - why is this not default behaviour? Am I being unimaginitive in not being able to think of a scenario where this plugin wouldn’t be useful?
Because it’s executed on every request and anchor tags probably won’t appear on a lot of pages, it’s unnecessary processing overhead even to cached pages if you don’t need it. As default behavior this could degrade performance and unless you cannot author the pages with the proper anchor tags, it’s IMO unnecessary.]]>
opengeek Jun 18, 2009, 07:07 AM https://forums.modx.com/thread/35800/plugin-anchorsaway?page=2#dis-post-199469