{{indexmenu_n>200}} ====== CPs images
Caption-TextXX|Alt-TextXX||Title-TextXX|Copyright-TextXX
==== In the template: ====
==== Ergebnis Frontend: ====
Mit dem Text des Feldes [Info:] und [Copyright] aus der Dateizentrale:
\\
===== 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:** -> [[http://www.phpwcms-docu.de/config_files.phtml|config/phpwcms/conf.inc.php]] \\
* $phpwcms['allow_ext_init'] = 1;
----
\\
===== PHP: =====
File: **template/inc_script/frontend_init/cp_trigg_images_info_copyright.php**
/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//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 (29) / image special (31)
// and Tag available?
if ( ( ($data['acontent_type'] == 29 OR $data['acontent_type'] == 31) ) AND // cp image 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');
?>
\\