Copyright & Infotext mit Tags

Eine recht einfache Version um die Einträge Copyright, Infotext und Kurztext aus der Dateizentrale darzustellen.
- Mit LightBox für die Bildvorschau (Technik: cmsimage.php) und Übergabe des Infotext (einfache Formatierung möglich [BB-Code]).

Tags im Template:
- {X_COPYRIGHT:{FILE_ID}}
- {X_INFOTEXT:{FILE_ID}}
- {X_KURZTEXT:{FILE_ID}}


Frontend:

Backend CP:

Backend Dateiliste:



Docu: –
Forum: Umfangreicheres Download-Tool als Dateiliste?

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

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

  • $phpwcms['allow_ext_init'] = 1;
  • $phpwcms['allow_cntPHP_rt'] = 1;


Template

Datei: /template/inc_cntpart/filelist/x_copyright_infotext.html

Mit LightBox für Vorschau (Technik: cmsimage.php) und Übergabe Infotext (formatierbar)

template

<!--FILE_SETTINGS_START//-->
; this is formatted like WIN.INI
; please: do not use comments for value lines
icon_path             = "img/icons/"
icon_name             = "small_icon_{FILE_EXT}.gif"
thumbnail            = 1
thumbnail_width        = 50
thumbnail_height    = 50
thumbnail_crop        = 1
lightbox_init        = 1
file_size_round        = 1
file_size_space        = " "
date_format            = "%d.%m.%Y"
set_locale            = "de_DE@Euro"
<!--FILE_SETTINGS_END//-->
[TITLE]<h3>{TITLE}</h3>[/TITLE]
[SUBTITLE]<h4>{SUBTITLE}</h4>[/SUBTITLE]
[TEXT]{TEXT}[/TEXT]
<div style="margin-top: 15px; padding-top: 10px; border-top: 1px dotted #CCCCCC;">
<!--FILE_ENTRY_START//-->
    <div class="fileEntry" style="margin-bottom:10px; padding-bottom: 10px; border-bottom: 1px dotted #CCCCCC;" id="file-{FILE_ID}">
        <h2 style="padding-bottom: 5px;">
        <a href="{FILE_LINK}&amp;target=0"{FILE_TARGET}>[FILE_TITLE]{FILE_TITLE}[/FILE_TITLE][FILE_TITLE_ELSE]{FILE_NAME}[/FILE_TITLE_ELSE]</a>
        </h2>
            [FILE_IMAGE_ELSE]<div style="float: left; margin-right: 10px; height: 140px;"><img src="{FILE_ICON}" alt="" border="0" /></div>[/FILE_IMAGE_ELSE]
            [FILE_IMAGE]
            <div style="float: left; margin-right: 10px; height: 140px;">
<!--            <a href="img/cmsimage.php/{FILE_IMAGE_WIDTH}x{FILE_IMAGE_HEIGHT}/{FILE_ID}.{FILE_EXT}" rel="lightbox[XYZ{FILE_ID}]" title="{X_INFOTEXT:{FILE_ID}}" target="_blank"> //-->
            <a href="img/cmsimage.php/800x600/{FILE_ID}.{FILE_EXT}" rel="lightbox[XYZ{FILE_ID}]" title="{X_INFOTEXT:{FILE_ID}}" target="_blank">
            <img src="{FILE_IMAGE}" alt="{FILE_NAME}" title="[FILE_TITLE]{FILE_TITLE}[/FILE_TITLE][FILE_TITLE_ELSE]{FILE_NAME}[/FILE_TITLE_ELSE]" border="" /></a>
            </div>
            [/FILE_IMAGE]
 
        [FILE_DESCRIPTION]<p><strong>{FILE_DESCRIPTION}</strong><br /></p>[/FILE_DESCRIPTION]
        <p>Dateiname: {FILE_NAME} - Extend: {FILE_EXT} -   ID:{FILE_ID}<br />
        Erstellt am: {FILE_DATE} - Größe: {FILE_SIZE}
        </p>
        [FILE_IMAGE]
        [FILE_IMAGE_WIDTH]
        Format: [FILE_IMAGE_LANDSCAPE]quer[/FILE_IMAGE_LANDSCAPE][FILE_IMAGE_PORTRAIT]hoch[/FILE_IMAGE_PORTRAIT]
        &nbsp; - B x H: {FILE_IMAGE_WIDTH} x {FILE_IMAGE_HEIGHT}px<br />
        Modus: {FILE_IMAGE_CHANNEL} &nbsp;&nbsp; - MIME type: {FILE_IMAGE_MIME}<br />
        [/FILE_IMAGE_WIDTH]
        [/FILE_IMAGE]
        {FILE_DOWNLOADS} Downloads
 
        <p>
        CopyRight: {X_COPYRIGHT:{FILE_ID}}<br />
        Info-Text: &nbsp;{X_INFOTEXT:{FILE_ID}}<br />
        Kurztext: &nbsp;{X_KURZTEXT:{FILE_ID}}<br />
        </p>
 
    </div>
    <div style="clear:left;"><!--clear//--></div>
<!--FILE_ENTRY_END//-->
</div>


PHP

Datei: /template/inc_script/frontend_init/cp_trig_filelist_copyright_infotext.php

template

<?php
// -------------------------------------------------------------------------------------------
// obligate check for phpwcms constants
    if (!defined('PHPWCMS_ROOT')) {
        die("You Cannot Access This Script Directly, Have a Nice Day."); }
// -------------------------------------------------------------------------------------------
 
// 10.03.10 K.Heermann  http://planmatrix.de
// Holt CopyRight & Infotext aus der DB und stellt ueber die Tags
// {X_COPYRIGHT:fileID}}, {X_INFOTEXT:fileID} und {X_KURZTEXT:{FILE_ID}} den Inhalt bereit
//
// Im Template: {X_COPYRIGHT:{FILE_ID}}, {X_INFOTEXT:{FILE_ID}}, {X_KURZTEXT:{FILE_ID}}
// --------------------------------------------------------------------------------------------
 
function FILELIST_COPYRIGHT_INFOTEXT($text, & $data) {
 
    // Der richtige CP filelist (7) und Tag vorhanden?
    if     ( $data['acontent_type'] == 7  AND
        ( strpos($text, '{X_COPYRIGHT:') OR strpos($text, '{X_INFOTEXT:') ) )  // TAGs vorhanden?
    {
 
        // alle {COPYRIGHT:f_id} einlesen wenn vorhanden
        preg_match_all('/{COPYRIGHT:(.*?)}/',$text, $fileID);
 
        // alle {INFOTEXT:f_id} einlesen wenn vorhanden
        if (empty ($fileID[0])) preg_match_all('/{INFOTEXT:(.*?)}/',$text, $fileID);
 
        // Irgendetwas verwertbares vorhanden?
        if (!empty ($fileID[0])) {
 
                // Daten  holen und ersetzen
                foreach($GLOBALS['content']['files_result'] as $key=>$value) {
 
                    // ----- CopyRight ersetzen
                    $text = str_replace('{X_COPYRIGHT:'.$value['f_id'].'}', $value['f_copyright'], $text);
 
                    // ----- Kurztext ersetzen
                    $text = str_replace('{X_KURZTEXT:' .$value['f_id'].'}', $value['f_shortinfo'], $text);
 
                    // ------ Infotext formatieren
                    $t = plaintext_htmlencode($value['f_longinfo']);
                    $t = (preg_match('/\A\<p\>(.*?)\<\/p\>\Z/is',$t,$matches))? $matches[1]: $t; //Umschlieszer <p> ..</p> loeschen
 
                    $text = str_replace('{X_INFOTEXT:' .$value['f_id'].'}', $t, $text);
                }
        }
    }
 
    return $text;
}
 
register_cp_trigger('FILELIST_COPYRIGHT_INFOTEXT');
 
?>
deutsch/phpwcms-system/artikel/contentparts/dateiliste/copyright-infotext-tags.txt · Last modified: 2018/06/03 18:08 (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