This is an old revision of the document!


Replace word in text and title

RT Replace recurring term by variable.

If several similar texts are in different structural levels available, itself differ only by a recurring term, as e.g. a city name or a sentence, you can be used these rt.

The text is written only one time. The placeholder {WORD} is used in the places of the recurring term. Now the text can be in-copied simply into the articles (CPs).

Insert in Admin ⇒ Side structure Seitentitel this word/sentence for the current category or alternatively in the highest category for all following categories.

The word/sentence is transferred also into the title tag of the side.

Priority: 1.current category - 2.First level for all following sub levels


rt_word_text_title V1.0 13.06.09

Docu: –
Forum: Wiederkehrenden Begriff durch Variable ersetzen

Autor: O.Georgi http://phpwcms.de → Enhanced: K.Heermann (flip-flop) http://planmatrix.de
CMS Version: >= 1.3
Version: V1.0

Tag: {WORD}

Filename: rt_word_text_title.php

Folder: template/inc_script/frontend_render/

Condition:/config/phpwcms/conf.inc.php

  • $phpwcms['allow_ext_render'] = 1;


replace_word_text_title

<?php
/*****************************************************************************
 Ersetzendes Wort (Satz) direkt auf Basis des Seitentitels vorgegeben.
 Direkt in der aktuellen Ebenen oder der ersten Ebene fuer alle folgenden Unterebenen
 Priorität: 1.Aktuelle Ebene - 2.Erste Ebene fuer alle folgenden Unterebenen
 
 Einsetzen des Wortes (Satzes) in der Strukturebene im Feld Seitentitel
 Tag setzen in Text: {WORD}
 
 13.06.09: O.Georgi
 Erweitert: K.Heermann
 Forum: http://forum.phpwcms.org/viewtopic.php?f=8&p=117330#p117330
******************************************************************************/
 
// ----------------------------------------------------------------
// OBLIGATE CHECK FOR PHPWCMS CONSTANTS
if (!defined('PHPWCMS_ROOT')) {die("You Cannot Access This Script Directly, Have a Nice Day.");}
// ----------------------------------------------------------------
 
 
// Stadtnamen direkt auf Basis des Seitentitels vorgegeben in der ersten Ebene
// fuer alle folgenden Unterebenen oder direkt für die aktuelle Ebene.
 
 
// Standardwert
$word = 'Stadt';
 
 
// Ist der Tag ueberhaupt vorhanden?
if ( strpos($content["all"], '{WORD}') ) {
 
  // fuer aktuelle Seitentitel vorhanden?
  if ($content["struct"][$content["cat_id"]]["acat_pagetitle"]) {
 
    $word = $content["struct"][$content["cat_id"]]["acat_pagetitle"];
  }
 
  // sonst Seitentitel aus erstem Level fuer alle folgenden Unterebenen verwenden
  elseif(isset($LEVEL_ID[2])) {
 
    // Ist eine Seitentitel im Ersten Level vorhanden? sonst default - siehe oben
    $word = $content['struct'][ $LEVEL_ID[1] ]['acat_pagetitle'] ? $content['struct'][ $LEVEL_ID[1] ]['acat_pagetitle'] : $word;
  }
  // Pruefen ob derdas Wort im Titel schon vorhanden ist
  if (strpos($content["pagetitle"], $word)!= false ) {
 
    // Nicht vorhanden, also anhaengen
    $content["pagetitle"] .= '|' . $word;
  }
 
  $content['all'] = str_replace('{WORD}', html_entities($word), $content['all']);
 
}
 
 
?>
english/phpwcms_replacer_rts/frontend_render/word-text-title.1244923839.txt.gz · Last modified: 2018/06/03 18:08 (external edit)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0