NAVIGATION
This RT offers the possibility to jump to CP-anchors and anchors itself set within an article.
Better translate
Prerequisites:
TAG: * {GO-A:CP-ID,Link text} * {GO-A:Ankertext,Link text}
Condition in the TAG:
If a condition is not fulfilled, an error text displayed in the FE.
<note> The RT does not check for the existence of valid jump targets! </note>
Example:
{GO-A:149,Link text}
<a href="#cpid149" class="phpwcmsAnchorLink-GO" title="Link text">Link text</a>
{GO-A:MyAnchorName,Link text}
<a href="#MyAnchorName" class="phpwcmsAnchorLink-GO" title="Link text">Link text</a>
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: → /config/phpwcms/conf.inc.php
File: template/inc_script/frontend_render/rt_goto_anchor.php
<?php /** * ***************************************************************************** * 16.08.2011 V1.0 K.Heermann http://planmatrix.de * * GoTo anchor link * * Tags v1.0: * - {GO-A:CP-ID,Link text} * - {GO-A:Anchor_name,Link text} * *CP-ID: * - Only numeric values * * Anchor_name: * - One word, no spaces * - No special characters and umlauts. * * Link text: * - If there is no link text an error occures * - Minimum word length is three characters * ***************************************************************************** */ // ----------------------------------------------------------------------------- // obligate check for phpwcms constants if (!defined('PHPWCMS_ROOT')) { die("You Cannot Access This Script Directly, Have a Nice Day."); } // ----------------------------------------------------------------------------- if (strpos($content["all"],'{GO-A:') !== false) { // Is there any anchor jump? // cp anchor is available IF (strpos($content["all"],'<a name="cpid') !== false) { $mySearch = '/\{GO-A:(\d+),([\x20-\x7F]{3,})\}/is'; $myReplace = '<a href="#cpid$1" class="phpwcmsAnchorLink-GO" title="$2">$2</a>'; $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 = '<a href="#$1" class="phpwcmsAnchorLink-GO" title="$2">$2</a>'; $content['all'] = preg_replace($mySearch, $myReplace, $content['all']); } // Error output $mySearch = '/\{GO-A:(.*?)\}/is'; $myReplace = '<b style="color:red">Anchor error:</b> "$1"'; $content['all'] = preg_replace($mySearch, $myReplace, $content['all']); $content['all'] = str_replace('\'', ''', $content['all']); $content['all'] = str_replace('&quot;', '"', $content['all']); } ?>