CP-Kommentarausgabe

Unterstützt die Ausgabe des CP Kommentarfeldes mit Hilfe eines TAG im Text oder einer Vorlage.
TAG: → {CPCOMMENT}

Beschreibung:

Wird der TAG {CPCOMMENT} im CP Text oder in einer Vorlage gesetzt, so wird an dieser Stelle der Inhalt des zugehörigen Kommentarfelds ausgegeben.

Die Klasse <span="cpcomment"> .... </span> wurde als Umschließer für die Kommentausgabe gesetzt.

Zusätzlich kann bestimmt werden, in welchen CP's nach dem TAG gesucht wird. (IF statement …)

  1. Filtern nach Content Part Typen
  2. Filtern nach Kategorie ID´s
  3. Filtern nach Artikel ID´s
  4. Filtern nach CP ID´s
  5. Oder verwende eine Kombination aus den oben gezeigten Abfragen.

Wird das einführende IF-Statement mit seiner schließenden Klammer auskommentiert, werden alle CPs untersucht. (Geschwindigkeit!!)



Docu: –
Forum: –

Autor: K.Heermann (flip-flop) http://planmatrix.de
CMS Version: >= 1.3x
Version: V1.0 (20.02.2011)

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

  • $phpwcms['allow_ext_init'] = 1;



PHP:

Datei: /template/inc_script/frontend_init/cp_trig_comment_output.php

cp_trig_comment_output.php

<?php
// -------------------------------------------------------------------------------------------
// obligate check for phpwcms constants
  if (!defined('PHPWCMS_ROOT')) {
    die("You Cannot Access This Script Directly, Have a Nice Day."); }
// -------------------------------------------------------------------------------------------
//
// 20.02.11 KH (flip-flop) Out of the comment field by TAG {CPCOMMENT}
// -------------------------------------------------------------------------------------------
 
 
   function CP_Comment_field_Output($text, & $data) {
 
      // CP filter in use:
      // - Please enhance the array for your needs, have a look into
      // - http://www.phpwcms-howto.de/wiki/doku.php/english/technics/internal-function-call/content-part-types
      // e.g. CPs: 0 => Plain Text, 6 => HTML, 15 => WYSIWYG, 29 => IMAGE <div>
      // If you don´t need a filter (all CPs will be processed), please disable the if statement and the associated closing parenthesis
 
      // Second example for processing only cp´s are located in specific category
      // Third example for processing only cp´s are located in specific articles
      // Forth example for processing only cp´s with it´s unique cp id
 
 
 
      // 1) Filter by Content Part Types
//      if( in_array($data['acontent_type'], array(0,6,14,29)) ) { // is used only when the CP-filter is needed.
 
      // 2) Filter by category
//      if( in_array($GLOBALS["content"]["struct"][$GLOBALS["content"]["cat_id"]]["acat_id"], array(0,6,14,29)) ) { // is used only when the CP-filter is needed.
 
      // 3) Filter by unique article id´s
//      if( in_array($data['acontent_aid'], array(0,6,14,29)) ) { // is used only when the CP-filter is needed.
 
      // 4) Filter by unique cp id´s
      if( in_array($data['acontent_id'], array(10,6,14,29)) ) { // is used only when the CP-filter is needed.
 
        // Replaces the TAG and put a class around it.
        $text = str_replace("{CPCOMMENT}",       '<span class="cpcomment">'.$data['acontent_comment'].'</span>', $text);  // replace cp Comment
 
      } // Used only if a CP-filter is in use.
 
      // Delete all unused TAGs
      else
        $text = str_replace("{CPCOMMENT}",       '', $text);
 
 
      return $text;
   }
 
 
   register_cp_trigger('CP_Comment_field_Output');
?>


deutsch/ersetzer_rts/frontend_init/cp_trigger/cp-comment-output.txt · Last modified: 2018/06/03 18:09 (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