CP´s Bilder <div>/spezial

In den Templates der CPs “Bilder <div>” und “Bilder spezial” können mit diesem RT die Informationen aus der Dateizentrale der Felder Info: und Copyright: in die beiden TAGs {XFILE_INFO:{IMAGE_ID}} und {XFILE_COPYR:{IMAGE_ID}} eingesetzt werden.


Beispiel: Bilder <div>

Frontend:


Dateizentrale:


Bildunterzeile:

Caption-TextXX|Alt-TextXX||Title-TextXX|Copyright-TextXX

Im Template:

<div class="imageEntry[FIRST] first[/FIRST][LAST] last[/LAST][ROW] row{ROW}[/ROW]" id="img{IMGID}" style="float:left;">
    <a target="_blank" title="{XFILE_INFO:{IMAGE_ID}} <br>Copyright: {XFILE_COPYR:{IMAGE_ID}}" rel="lightbox[2XbmK-{ID}]" href="{IMAGE_REL}"><img border="0" height="{THUMB_HEIGHT}" width="{THUMB_WIDTH}" title="{TITLE}" alt="{ALT}" src="{THUMB_REL}"/></a>
    <div style="width:{THUMB_WIDTH}px">[CAPTION]<p>{CAPTION} <br>Copyright aus CP: {COPYRIGHT}</p>[/CAPTION][CAPTION_ELSE]<p>{XFILE_INFO:{IMAGE_ID}}</p>[/CAPTION_ELSE]</div>
</div>

Ergebnis Frontend:

Mit dem Text des Feldes [Info:] und [Copyright] aus der Dateizentrale:

<div class="imageEntry first last row1" id="img0" style="float: left;">
    <a target="_blank" title="Nordsee: &lt;br /&gt;Düne &lt;br /&gt;Copyright: KH" rel="lightbox[2XbmK-40]" href="content/images/f061a565f9369f42d53307dd555e8b3d.jpg"><img title="Caption-Text01" alt="Alt-Text01" src="content/images/873aac80f32680ac05a8c646a84c9fd1.jpg" border="0" height="120" width="120"></a>
    <div style="width: 120px;"><p>Caption-Text01 <br>Copyright aus CP: Copyright-Text</p></div>
</div>


Beschreibung:

Die beiden TAGs

  • {XFILE_INFO:{IMAGE_ID}}
  • {XFILE_COPYR:{IMAGE_ID}}

können an jeder Stelle der Templates eingesetzt werden.



Docu: –
Forum: –

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

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

  • $phpwcms['allow_ext_init'] = 1;


PHP:

Datei: template/inc_script/frontend_init/cp_trigg_images_info_copyright.php

cp_trigg_images_info_copyright.php

<?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.02.12 K.Heermann  http://planmatrix.de
 *
 * Bilder-Info/Copyright aus Dateizentrale in Template der CPs Bilder/<div>/spezial einsetzen
 * TAGs:   {XFILE_INFO:{IMAGE_ID}} und {XFILE_COPYR:{IMAGE_ID}}
 
 * Insert image infos/copyright from file center into the templates of the cps image/<div>/special
 * TAGs:   {XFILE_INFO:{IMAGE_ID}} and {XFILE_COPYR:{IMAGE_ID}}
 **********************************************************************************************
*/
 
 
function TRIGG_CP_IMAGE_READ_FILE_INFO_COPYR_V10($text, & $data) {
 
    // Der richtige CP:  image <div> (29) / image special (31)
    // and Tag available?
 
    if    (    ( ($data['acontent_type'] == 29 OR $data['acontent_type'] == 31) ) AND                         // cp image <div> or cp image special
            ( strpos($text, '{XFILE_INFO:') !== FALSE OR strpos($text, '{XFILE_COPYR:' ) !== FALSE ) )     // TAG is set ?  // TAG vorhanden?
    {
        // TAGs im Text selektieren
        preg_match_all ('/(\{XFILE_INFO:|\{XFILE_COPYR:)(\d+)\}/is', $text, $matches);
 
        if(isset($matches['2'])) {
 
            $info = getfileinformation($matches['2']);  // Daten aus Dateizentrale holen
 
            foreach ($info as $key=>$value) {
 
                $value['f_longinfo']  = nl2br($value['f_longinfo']);  // Zeilenumbruch setzen wenn vorhanden
 
                // TAG im text ersetzen
                $text = str_replace('{XFILE_INFO:' .$value['f_id'].'}', $value['f_longinfo'], $text);
                $text = str_replace('{XFILE_COPYR:'.$value['f_id'].'}', $value['f_copyright'], $text);
            }
 
            unset($info);
 
        }
 
    }
 
    return $text;
}
 
register_cp_trigger('TRIGG_CP_IMAGE_READ_FILE_INFO_COPYR_V10');
 
?>


deutsch/ersetzer_rts/frontend_init/cp_trigger/dateizentrale-text-in-bilder-cps/bilder-div_bilder-spezial.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