{{indexmenu_n>510}}
====== Change CP anchor text ======
**RT: Give CP anchors meaningful names.**
This RT offers the possibility for CP anchors to give them "meaningful names".
An anchor that can be specified autom. for each CP e.g. **%%%%** //(123 is the CP-Id)// \\
will become: **%%%%**
These names are set in the respective CP
* With a TAG in the Notes field e.g. **[Xanchor:**nice-cp-text-anchor**]**
* or titles or subtitles may be used for the text.
The settings have to be made in the script in CUSTOM VAR.
Additionally, you can set whether hidden CPs //(when working with CP alias or SHOW_CONTENT)// are involved in the process. //(Default: $visible_cp = false;)//
In front of each anchor a text can be defined, for example, **%%$prev_anchor = 'prev-';%%** === > **%%%%**. \\
This is also adjusted in the script in CUSTOM VAR.
**Usable characters:**
(a-z A-Z) (0-9) (_) (-) (.) \\
All other characters are converted, for example "Mein größter Ankertext" will be converted to "mein_groesster_ankertext". \\
All characters are converted to lowercase. If this isn't a wanted behaviour, please comment out the statement **%%$str = strtolower( $str );%%** in "%%function rt_val_special_chars($str)%%".
If you want another replacement this can be changed in the above Function.
\\
----
**rt_change_cp_anchor_text** V1.0 12.06.2010
Docu: -- \\
Forum: [[http://forum.phpwcms.org/viewtopic.php?p=124823]]
**Author:** K.Heermann (flip-flop) http://planmatrix.de \\
**CMS Version:** >= 1.3 \\
**Version:** V1.0 \\
Tag: -- \\
Filename: **rt_change_cp_anchor_text.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_change_cp_anchor_text.php
* to
*
*
* hhttp://forum.phpwcms.org/viewtopic.php?p=124823
*
* TAG: [Xanchor:nice-cp-anchor-text] in the comment field of the displayed CP
* Places this tag first in comment field!!!
*
* Location: Put it into the file e.g.:
* /template/inc_script/frontend_render/rt_change_cp_anchor_text.php
* Switch in conf.inc.php: $phpwcms['allow_ext_render'] = 1;
*
* Knut Heermann (flip-flop) http://planmatrix.de
*
* **************************************************************************
*/
// -------------------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
die("You Cannot Access This Script Directly, Have a Nice Day.");
}
// -------------------------------------------------------------------------
// Ist ein CP Anker vorhanden
// Only run if a cp achor is available
if ( strpos($content["all"], ' '_', '\\' => '-', '/' => '-',
'ä' => 'ae', 'ö' => 'oe', 'ü' => 'ue',
'Ä' => 'Ae', 'Ö' => 'Oe', 'Ü' => 'Ue', 'ß' => 'ss',
'à' => 'a', 'á' => 'a', 'â' => 'a' , 'ã' => 'a', 'å' => 'a',
'ç' => 'c',
'è' => 'e', 'é' => 'e', 'ê' => 'e' , 'ë' => 'e',
'ì' => 'i', 'í' => 'i', 'î' => 'i' , 'ï' => 'i',
'ò' => 'o', 'ó' => 'o', 'ô' => 'o' , 'õ' => 'o', 'õ' => 'o', 'ø' => 'o',
'ù' => 'u', 'ú' => 'u', 'û' => 'u' ,
'ý' => 'y', 'ÿ' => 'y',
'ñ' => 'n'
);
$str = strtr( $str, $replace );
// Convert into lower case: Comment it out if you do not need it.
$str = strtolower( $str );
return trim( $str );
}
// *************************************************************************
// CP ID holen // Catch cp id
if (preg_match_all('/\