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 08:55] Knut Heermann (flip-flop) |
deutsch:ersetzer_rts:frontend_init:cp_trigger:dateizentrale-text-in-bilder-cps [2018/06/03 18:09] (current) |
||
|---|---|---|---|
| Line 2: | Line 2: | ||
| - | ====== Dateizentraletexte in Bilder CP´s ====== | + | ====== Texte aus Dateizentrale in Bilder CP´s ====== |
| - | In den CPs "Text mit Bild", "Bilder", "Bilder <div>" und "Bilder spezial" können mit diesem RT die Informationen aus der Dateizentrale in 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. |
| - | |||
| - | |||
| - | ===== Beschreibung: ===== | ||
| - | CUSTOM var | ||
| - | |||
| - | - 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> | ||
| - | 'Eintrag' -> Eingabefeld in der Dateizentrale | ||
| - | +--------------+--------------------------------------+ | ||
| - | 'f_shortinfo' -> Keywords: Zusätzlich: | ||
| - | 'f_longinfo' -> Info: | ||
| - | 'f_copyright' -> Copyright | ||
| - | 'f_tags' -> Tag/Schlagwort: | ||
| - | +--------------+--------------------------------------+ | ||
| - | </file> | ||
| \\ | \\ | ||
| - | <code> | + | ===== Kleine Linkübersicht ===== |
| - | + | ||
| - | + | ||
| - | </code> | + | |
| - | \\ | + | |
| - | + | ||
| - | ---- | + | |
| - | 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; | + | |
| - | + | ||
| - | ---- | + | |
| - | + | ||
| - | + | ||
| - | \\ | + | |
| - | + | ||
| - | ===== Bsp.-Template: ===== | + | |
| - | + | ||
| - | Datei: **/template/inc_cntpart/teaser/my_template01.tmpl** | + | |
| - | + | ||
| - | <code html |h my_template01.tmpl |h> | + | |
| - | <!--TEASER_HEAD_START//--> | + | |
| - | <!--TEASERX_01//--> | + | |
| - | <!--TEASERX_LEER_01//--> | + | |
| - | <div style="margin:15px 0 15px 0;background-color:#E6E9F0;padding:7px;width:250px;"> | + | |
| - | + | ||
| - | <h3>{TITLE}</h3> | + | |
| - | <h5>{SUBTITLE}</h5> | + | |
| - | <br> | + | |
| - | <!--TEASERX_LEER_02//--> | + | |
| - | <!--TEASER_HEAD_END//--> | + | |
| - | + | ||
| - | <!--TEASER_ENTRY_START//--><!--TEASERX_CONTENT//--> | + | |
| - | <div[PRIO] class="prio{PRIO}"[/PRIO]> | + | |
| - | <h3><a href="{ARTICLELINK}">{TITLE} »</a></h3> | + | |
| - | [IMAGE]<div style="float:left; margin:2px 5px 2px 0">{IMAGE}[CAPTION]<p>{CAPTION}</p>[/CAPTION]</div>[/IMAGE] | + | |
| - | <div>{DATE:d/m/y lang=EN}[SUBTITLE] <b>{SUBTITLE}.</b>[/SUBTITLE] | + | |
| - | {SUMMARY} <a href="{ARTICLELINK}">»</a></div> | + | |
| - | </div>[IMAGE] | + | |
| - | <!-- | + | |
| - | Thumbnail {THUMB_NAME} | + | |
| - | Relative {THUMB_REL} | + | |
| - | Absolute {THUMB_ABS} | + | |
| - | WxH {THUMB_WIDTH}px x {THUMB_HEIGHT}px | + | |
| - | //-->[/IMAGE] | + | |
| - | <!--TEASER_ENTRY_END//--> | + | |
| - | + | ||
| - | <!--TEASER_SPACER_START//--> | + | |
| - | <hr style="margin:7px 0 7px 0;padding:0;height:0;border:0;border-bottom:1px dotted #CCCCCC;clear:both" /> | + | |
| - | <!--TEASER_SPACER_END//--> | + | |
| - | + | ||
| - | <!--TEASER_FOOTER_START//--> | + | |
| - | <!--TEASERX_LEER_01//--> | + | |
| - | <div style="clear:both;height:1px"></div> | + | |
| - | </div> | + | |
| - | <!--TEASERX_LEER_02//--> | + | |
| - | <!--TEASER_FOOTER_END//--> | + | |
| - | </code> | + | |
| - | + | ||
| - | \\ | + | |
| - | + | ||
| - | ===== 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> | + | |
| - | + | ||
| - | \\ | + | |
| - | + | ||
| + | {{indexmenu>deutsch:ersetzer_rts/frontend_init/cp_trigger/dateizentrale-text-in-bilder-cps|js#doku navbar msort nsort nocookie notoc}} | ||