{{indexmenu_n>100}} ====== CP-Comment output ====== **Supports the output of the CP comment field with the help of a TAG in text or template.** \\ TAG: -> {CPCOMMENT} ===== Description: ===== If the TAG **{CPCOMMENT}** is set in CP text or template, at this point the content of the associated comment field is displayed. I have set the class %% .... %% as a wrapper for the comment output. Additionally you can determine which CP´s will be searched for TAGs. //(IF statement ...)// - Filter by [[english/technics/internal-function-call/content-part-types]] - Filter by unique category id´s - Filter by unique article id´s - Filter by unique cp id´s - Or use a combination of the queries shown above. By commenting the introducing IF-Statement with it's closing bracket all CPs will be searched. (speed!!) \\ ---- Docu: -- \\ Forum: -- **Author:** K.Heermann (flip-flop) http://planmatrix.de \\ **CMS Version:** >= 1.3x \\ **Version:** V1.0 //(20.02.2011)// \\ **Condition:** -> [[http://www.phpwcms-docu.de/confincphp_de.phtml|/config/phpwcms/conf.inc.php]] \\ * $phpwcms['allow_ext_init'] = 1; ---- \\ \\ ===== PHP: ===== File: **/template/inc_script/frontend_init/cp_trig_comment_output.php** Plain Text, 6 => HTML, 15 => WYSIWYG, 29 => IMAGE
// 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}", ''.$data['acontent_comment'].'', $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'); ?> \\