CPs images <div>/special

FIXME

translate

With this rt we can be taken the information of the fields long info: and copyright: from file center using the two TAGs {XFILE_INFO:{IMAGE_ID}} and {XFILE_COPYR:{IMAGE_ID}} in the templates of the cp´s “images <div>” and “images special”.


Example: imagesr <div>

Frontend:


Filecenter:


Image caption:

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

In the 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>


Description:

The two TAGs

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

can be used anywhere in the template.



Docu: –
Forum: –

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

Condition:config/phpwcms/conf.inc.php

  • $phpwcms['allow_ext_init'] = 1;


PHP:

File: 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) {
 
    // The right 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?
    {
        // Select TAGs in the text  // TAGs im Text selektieren
        preg_match_all ('/(\{XFILE_INFO:|\{XFILE_COPYR:)(\d+)\}/is', $text, $matches);
 
        if(isset($matches['2'])) {
 
            $info = getfileinformation($matches['2']);  // Fetch data from file center  // Daten aus Dateizentrale holen
 
            foreach ($info as $key=>$value) {
 
                $value['f_longinfo']  = nl2br($value['f_longinfo']);  // Put line breaks if available  // Zeilenumbruch setzen wenn vorhanden
 
                // Replace TAG in the text  // 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');
 
?>


english/phpwcms_replacer_rts/frontend_init/cp_trigger/filecenter-text-in-image-cps/images-div_images-special.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