NAVIGATION
This shows you the differences between two versions of the page.
deutsch:ersetzer_rts:frontend_init:cp_trigger:dateizentrale-text-in-bilder-cps [2010/05/10 10:08] Knut Heermann (flip-flop) |
deutsch:ersetzer_rts:frontend_init:cp_trigger:dateizentrale-text-in-bilder-cps [2018/06/03 18:09] (current) |
||
---|---|---|---|
Line 5: | Line 5: | ||
- | In den CPs "Text mit Bild", "Bilder", "Bilder <div>" und "Bilder spezial" können mit diesem RT die Informationen aus der Dateizentrale in den jeweiligen ALT-Tag übernommen werden. | + | In den CPs "Text mit Bild", "Bilder", "Bilder <div>" und "Bilder spezial" können mit diesen RTs die Informationen aus der Dateizentrale in die jeweiligen TAGs übernommen werden. |
- | |||
- | |||
- | |||
- | {{:deutsch:ersetzer_rts:frontend_init:cp_trigger:file_center_be_info_text_de_1.gif|}} | ||
- | |||
- | |||
- | |||
- | ===== Beschreibung: ===== | ||
- | |||
- | {{:deutsch:ersetzer_rts:frontend_init:cp_trigger:cp_image_be_de.snag_1.gif|}} | ||
- | |||
- | - In der Bildunterzeile muss der Teil für den Alt-Tag frei bleiben, damit dieser RT richtig arbeiten kann. | ||
- | <file>CAPTION-TEXT|||TITLE-TEXT</file> | ||
- | |||
- | - In das Notizfeld des CPs wird dazu der Tag "[XIMAGES_INFO]" eingetragen um kenntlich zu machen dass dieser CP entsprechend behandelt wird. | ||
\\ | \\ | ||
- | - Im Script kann im Bereich "CUSTOM var" festgelegt werden welche Info aus der Dateizentrale in den alt-Tag eingesetzt werden soll. \\ | ||
- | <file>$replace_alt = 'f_shortinfo'; // default = 'f_shortinfo'</file> | ||
- | <file> | ||
- | 'Eintrag' -> Eingabefeld in der Dateizentrale | ||
- | +--------------+--------------------------------------+ | ||
- | 'f_shortinfo' -> Keywords: Zusätzlich: | ||
- | 'f_longinfo' -> Info: | ||
- | 'f_copyright' -> Copyright | ||
- | 'f_tags' -> Tag/Schlagwort: | ||
- | +--------------+--------------------------------------+ | ||
- | </file> | ||
- | |||
- | \\ | ||
- | |||
- | |||
- | ---- | ||
- | Docu: -- \\ | ||
- | Forum: -- | ||
- | |||
- | **Autor:** K.Heermann (flip-flop) http://planmatrix.de \\ | ||
- | **CMS Version:** >= 1.4x \\ | ||
- | **Version:** V1.0 //(05.05.2010)// \\ | ||
- | |||
- | **Bedingung:** -> [[http://www.phpwcms-docu.de/confincphp_de.phtml|/config/phpwcms/conf.inc.php]] \\ | ||
- | * $phpwcms['allow_ext_init'] = 1; | ||
- | |||
- | ---- | ||
- | |||
- | |||
- | \\ | ||
- | |||
- | |||
- | |||
- | ===== PHP: ===== | ||
- | |||
- | Datei: **/template/inc_script/frontend_init/cp_trig_image_read_filecenter10.php** | ||
- | |||
- | <code php |h cp_trig_image_read_filecenter10.php |h> | ||
- | <?php | ||
- | // ------------------------------------------------------------------------------------------- | ||
- | // obligate check for phpwcms constants | ||
- | if (!defined('PHPWCMS_ROOT')) { | ||
- | die("You Cannot Access This Script Directly, Have a Nice Day."); } | ||
- | // ------------------------------------------------------------------------------------------- | ||
- | /** | ||
- | ********************************************************************************************* | ||
- | * Simple Version 1.0 | ||
- | * 05.05.10 K.Heermann http://planmatrix.de | ||
- | * | ||
- | * Bilder-Infos aus Dateizentrale in alt-Tag der CP-Bilder einsetzen (CP Bilder/<div>/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/<div>/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 <div> (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 <div> | ||
- | $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'); | ||
- | |||
- | ?> | ||
- | </code> | ||
- | |||
- | \\ | ||
- | |||
+ | ===== Kleine Linkübersicht ===== | ||
+ | {{indexmenu>deutsch:ersetzer_rts/frontend_init/cp_trigger/dateizentrale-text-in-bilder-cps|js#doku navbar msort nsort nocookie notoc}} |