{{indexmenu_n>520}}
====== Jump to anchor ======
**This RT offers the possibility to jump to CP-anchors and anchors itself set within an article.**
FIXME Better translate
**Prerequisites:**
* Autom. anchor of each CP given with **Achor [x]** e.g. **%%%%** //(123 would be the id of the CP)// \\
* Anchor that can be placed anywhere in the CP using the TAG **{A:MeinAnker}** (**%%%%**). \\
\\
**TAG:**
* ##{GO-A:CP-ID,Link text}##
* ##{GO-A:Ankertext,Link text}##
\\
**Condition in the TAG:**
* CP-ID:
* Numeric value //(It is automatic. assumed that a contentpart-id part is meant).//
* Anchor_name:
* One word, no spaces, no special characters or umlauts //(It is assumed that a valid anchor is set in the page).//
* Link text:
* Minimum word length is three characters
If a condition is not fulfilled, an error text displayed in the FE.
**The RT does not check for the existence of valid jump targets!**
**Example:**
**{GO-A:149,Link text}**
Link text
\\
**{GO-A:MyAnchorName,Link text}**
Link text
\\
----
**rt_goto_anchor** V1.0 16.08.2011
Docu: -- \\
Forum: [[http://forum.phpwcms.org/viewtopic.php?p=131995]]
**Author:** K.Heermann (flip-flop) http://planmatrix.de \\
**CMS Version:** >= 1.3 \\
**Version:** V1.0 \\
Tag: -- ##{GO-A:CP-ID, Link text}## oder ##{GO-A:Anchor_text, Link text}##
Filename: **rt_goto_anchor.php**
Folder: ** template/inc_script/frontend_render/ **
**Condition:** -> [[http://www.phpwcms-docu.de/conf_inc_php_en.phtml|/config/phpwcms/conf.inc.php]] \\
* ##$phpwcms['allow_ext_render'] = 1;##
----
----
\\
===== Code: =====
**File:** template/inc_script/frontend_render/rt_goto_anchor.php
$2';
$content['all'] = preg_replace($mySearch, $myReplace, $content['all']);
}
// TAG anchor is available
IF (strpos($content["all"],'class="phpwcmsAnchorLink"') !== false) {
$mySearch = '/\{GO-A:([^\x7B-\xFF\s\W]+?),([\x20-\x7F]{3,})\}/is';
$myReplace = '$2';
$content['all'] = preg_replace($mySearch, $myReplace, $content['all']);
}
// Error output
$mySearch = '/\{GO-A:(.*?)\}/is';
$myReplace = 'Anchor error: "$1"';
$content['all'] = preg_replace($mySearch, $myReplace, $content['all']);
$content['all'] = str_replace('\'', ''', $content['all']);
$content['all'] = str_replace('"', '"', $content['all']);
}
?>