{{indexmenu_n>200}} ====== CP´s text w/image, images, images
/special ====== Using this rt we can be taken the information from file center into each ALT tag of the cp´s "image with text", "images", "images
" or "images special". {{:english:phpwcms_replacer_rts:frontend_init:cp_trigger:file_center_be_info_text_en_1.gif|}} \\ ===== Result frontend: ===== with text from the filecenter field [keywords: additional]: Keywords: image Expo ===== Description: ===== **Example: CP images** {{:english:phpwcms_replacer_rts:frontend_init:cp_trigger:cp_image_be_en.snag_1.gif|}} - **In caption** may not be entered a alt-tag, so that RT can work properly. CAPTION-TEXT|||TITLE-TEXT - **In notes field** we must fill in the tag "[XIMAGES_INFO]" in order to indicate clearly that this CP is treated accordingly. \\ **Script:** - **In the script** we can specify in "CUSTOM var" which info from the file center is inserted into the alt-tag. \\ $replace_alt = 'f_shortinfo'; // default = 'f_shortinfo' 'Entry' -> input field in file center +--------------+--------------------------------------+ 'f_shortinfo' -> keywords: additional: 'f_longinfo' -> long info: 'f_copyright' -> copyright: 'f_tags' -> tags: +--------------+--------------------------------------+ \\ ---- Docu: -- \\ Forum: -- **Author:** K.Heermann (flip-flop) http://planmatrix.de \\ **CMS Version:** >= 1.4x \\ **Version:** V1.0 //(05.05.2010)// \\ **Condition:** -> [[http://www.phpwcms-docu.de/conf_inc_php_en.phtml|/config/phpwcms/conf.inc.php]] \\ * $phpwcms['allow_ext_init'] = 1; ---- \\ ===== PHP: ===== File: **/template/inc_script/frontend_init/cp_trig_image_read_filecenter10.php** /spezial) * In der Bildunterzeile: Bildunterzeile|||Titel * Tag im CP Notizfeld: [XIMAGES_INFO] -> Nur zur Identifikation "Ist das der richtige CP" * Using image infos from file center in alt tag of the images in cp image/
/special * Tag in CP notes field: [XIMAGES_INFO] -> Only for identification "is this the right CP" * In CP in caption: Caption-Text|||Title-Text * ********************************************************************************************** */ function TRIGG_CP_IMAGE_READ_FILECENTER_V10($text, & $data) { // Der richtige CP: Text/wImage /1) / images (2) / image
(29) / image special (31) // and Tag available? if ( $data['acontent_type'] == 1 OR // cp image/text $data['acontent_type'] == 2 OR // cp images $data['acontent_type'] == 29 OR // cp image
$data['acontent_type'] == 31 AND // cp image special (strpos($data['acontent_comment'], '[XIMAGES_INFO]') !== false) // TAG is set ? // TAG vorhanden? ) { // ===CUSTOM var ======================================================== // Put in the right string ------ $replace_alt = 'f_shortinfo'; // default = 'f_shortinfo' // 'DB feld' -> Eingabefeld in der Dateizentrale // 'DB field' -> input field in file center // +--------------+----------------------------------------------------+ // 'f_shortinfo' -> keywords: additional: // Keywords: Zusätzlich: // 'f_longinfo' -> long info: // Info: // 'f_copyright' -> copyright: // Copyright // 'f_tags' -> tags: // Tag/Schlagwort: // +--------------+----------------------------------------------------+ // ===END CUSTOM var ==================================================== // alle file IDs holen wenn vorhanden direkt aus dem serialiserten String // i:0;s:2:"22"; // catch all file IDs if available from the serialized string if ($data['acontent_type'] == 1) { // cp image/text preg_match_all('/^(\d*?):/',$data['acontent_image'], $fileID); } else // all other image cp´s preg_match_all('/i:0;s:2:"(.*?)";/',$data['acontent_form'], $fileID); // Irgendetwas verwertbares vorhanden? // Is there any content available? if (!empty ($fileID[0])) { // Read the file entries from database // ----------------------------------- $ids = join("','", $fileID[1]); $sql = 'SELECT * '; $sql .= 'FROM '.DB_PREPEND.'phpwcms_file '; $sql .= "WHERE f_id IN ('$ids')"; $db_data = _dbQuery($sql); // ----------------------------------- // Inhalt aus DB verfuegbar? // Is there any content from db available? if(isset($db_data[0])) { $search = ''; $replace = ''; // Daten holen und ersetzen // Catch data from db and replace in text foreach($fileID[1] as $key=>$value0) { foreach($db_data as $key1=>$value1) if ($value1['f_id'] == $value0) { $search = $value1['f_name']; $replace = $value1[$replace_alt]; break; } // Replace in alt tag: file name to text from file center $text = preg_replace('/alt="'.$search.'"/i', 'alt="'.$replace.'"', $text, 1); } // ----- END foreach } // ------ END isset($db_data[0] } } return $text; } register_cp_trigger('TRIGG_CP_IMAGE_READ_FILECENTER_V10'); ?> \\