xtcDynCmsContainer Dynamisches CMS_HTML und CMS_HTMLHEAD

Gesperrt
yodatortenboxer
Beiträge: 424
Registriert: Do 22. Jan 2004, 14:45
Wohnort: Kölpinsee auf Usedom
Kontaktdaten:

xtcDynCmsContainer Dynamisches CMS_HTML und CMS_HTMLHEAD

Beitrag von yodatortenboxer » Fr 12. Okt 2012, 13:11

Hallo,

ich habe hier noch ein älteres Modul, vieleicht braucht jemand mal so etwas.
Daher stelle ich es hier zur verfügung.

Das Modul stellt beliebig viele HTML und HEADLINE bereiche in einer Seite dar.
Man muss also nicht mehr mehrere Template erstellen, wenn man einmal mehrere HTML-Bereiche braucht.
Es muss nur bei dem Artikel oder der Kategorie im Template die anzahl der Benötigten Bereiche und die Bereichart eingestellt werden, und schon wars das.
Braucht man unter einen Template mal ein HTML-Bereich mehr, erhöht man in der Templatkonfig nur die Anzahl um eins.

Hier einmal der Input:
xtcDynCmsContainerInput.JPG
xtcDynCmsContainer Input
xtcDynCmsContainerInput.JPG (20.56 KiB) 1859 mal betrachtet
Modul-Input:

Code: Alles auswählen

?><?php
/***********************************************
* Dynamisches CMS_HTML und CMS_HTMLHEAD
* 
* Inputbereich
*
* Author      :     Ralf Fleischer
* Copyright   :     Werbung R. Fleischer
* Mail        :     info@werbeagentur-usedom.de
* Created     :     14-07-2008
* Version     :     0.0.3
* Modified    :     14-07-2010
************************************************/

$sSubmitLink = '<a href="javascript:if (document.tplcfgform.send) {document.tplcfgform.send.value = 0}; document.tplcfgform.submit();"><img src="images/submit.gif" /></a>';
$sSubmitOnchange='javascript:if (document.tplcfgform.send) {document.tplcfgform.send.value = 0}; document.tplcfgform.submit();';
$fValue="CMS_VALUE[10]";

?>
<table style="border:1px solid #e2e2e2" cellpadding="0" cellspacing="0" border="0">
    <tr>
        <td>&nbsp;<?php echo mi18n("Anzahl der Felder:");?>&nbsp;</td>
        <td style="border-left:1px solid #e2e2e2;" colspan="3">&nbsp;<input type="text" name="CMS_VAR[10]" value="CMS_VALUE[10]" size="3" />&nbsp;
        <?php echo mi18n("speichern");?>&nbsp;<?php echo $sSubmitLink;?>&nbsp;</td>
    </tr>
    <tr>
        <td style="background:#f1f1f1;border-top:1px solid #e2e2e2;border-bottom:1px solid #e2e2e2;">&nbsp;</td>
        <td colspan="3" style="background:#f1f1f1;border-left:1px solid #e2e2e2;border-top:1px solid #e2e2e2;border-bottom:1px solid #e2e2e2;">&nbsp;<?php echo mi18n("Type");?>&nbsp;</td>
    </tr>
<?php
if($fValue!=""){
    for ($i=1;$i<=$fValue;$i++){
        if($i<=9){$ii="0".$i;}else{$ii=$i;}
        
        $fVar=20+$ii;
        $fVarTempName=$fVar;
        $fVarTempArt="a".$fVar;
        
        $fValueTempName="CMS_VALUE[$fVarTempName]";
        $fValueTempArt="CMS_VALUE[$fVarTempArt]";

        
        ?>
    <tr>
        <td style="border-left:1px solid #e2e2e2;"><input type="hidden" name="<?php echo "CMS_VAR[$fVarTempName]";?>" value="<?php echo $fVarTempName;?>" size="20" />&nbsp;</td>
        <td colspan="3" style="border-left:1px solid #e2e2e2;border-bottom:1px solid #e2e2e2;">
            <select name="<?php echo "CMS_VAR[$fVarTempArt]";?>" onChange="<?php echo $sSubmitOnchange; ?>">
                    <option value="cmshead"     <?php if($fValueTempArt=="cmshead"){echo "selected";}else{echo "";}?>>      <?php echo mi18n("&Uuml;berschrift");?></option>
                    <option value="cmshtml"     <?php if($fValueTempArt=="cmshtml"){echo "selected";}else{echo "";}?>>      <?php echo mi18n("Textbereich");?></option>
            </select>
        </td>
    </tr>
    <?php
    }
}
?>
</table>
<?php
Hier einmal das Ergebnis:
xtcDynCmsContainerOutput.JPG
xtcDynCmsContainer Output
xtcDynCmsContainerOutput.JPG (11.36 KiB) 1859 mal betrachtet
Modul Output:

Code: Alles auswählen

<?php
/***********************************************
* Dynamisches CMS_HTML und CMS_HTMLHEAD
* 
* Outputbereich
*
* Author      :     Ralf Fleischer
* Copyright   :     Werbung R. Fleischer
* Mail        :     info@werbeagentur-usedom.de
* Created     :     14-07-2008
* Version     :     0.0.3
* Modified    :     14-07-2010
************************************************/

########################################################            
################## Benötigte Variablen ##################
########################################################    

$fValueOut="CMS_VALUE[10]";

########################################################            
################## Contenido Includes ##################
########################################################    

cInclude("includes", "functions.general.php");
cInclude("includes", "functions.lang.php");
cInclude("classes", "class.htmlelements.php");

################################################            
################## Funktionen ##################
################################################ 


if ( !function_exists('make_cms_type')) {
    function make_cms_type( $container_type, $container_id ) {
        global $a_content, $idartlang, $idart, $idcat, $lang, $db, $edit, $sess, $client, $cfg, $cfgClient;
    
        $sql = "SELECT * FROM ".$cfg["tab"]["type"]." WHERE type = '$container_type'";
        $db->query($sql);
    
        $db->next_record();
        $cms_code = $db->f("code");
        $cms_idtype = $db->f("idtype");
    
        if( !$edit ) {
            $db2 = new DB_Contenido;
            $sql = "SELECT * FROM ".$cfg["tab"]["content"]." AS A, ".$cfg["tab"]["art_lang"]." AS B, ".$cfg["tab"]["type"]." AS C
                       WHERE A.idtype = C.idtype AND A.idartlang = B.idartlang AND B.idart = '".Contenido_Security::toInteger($idart)."' AND B.idlang = '".Contenido_Security::escapeDB($lang, $db)."' AND
                             A.idtype = '".$cms_idtype."' AND A.typeid = '".$container_id."'";
            $db2->query($sql);
            $db2->next_record();
            $a_content[$db2->f("type")][$db2->f("typeid")] = $db2->f("value");
        }
    
        $val = $container_id;
    
        eval($cms_code);
        $tmp_output = str_replace('\\\"','"',$tmp);
        $tmp_output = stripslashes($tmp_output);
    
        return $tmp_output;
    }
}

#########################################################################            
################## Zusammenbau der CMS_VALUE Variablen ##################
#########################################################################   

if(($fValueOut!="")AND($fValueOut>0)){
    for ($y=1;$y<=$fValueOut;$y++){
        
        $fVarTemp=20+$y;
        $fVarTempNameOut=$fVarTemp;
        $fVarTempArtOut="a".$fVarTemp;
        
        $fValueTempNameOut="CMS_VALUE[$fVarTempNameOut]";
        $fValueTempArtOut="CMS_VALUE[$fVarTempArtOut]";
        
        $FieldsArray[$fValueTempNameOut]=$fValueTempArtOut;
    }

    $Fields="";

####################################################
################## Ausgabe Felder ##################
####################################################

    foreach($FieldsArray as $Data => $Field){
        if($Data!=""){
            if($Field=="cmshead"){
                $Fields.="\n\t\t";
                $Fields.="<div id=\"cmsDynHeadline_".$Data."\" clas=\"cmsDynHeadline\"><h3>".make_cms_type("CMS_HTMLHEAD",$Data)."</h3></div>";
            }
            if($Field=="cmshtml"){
                $Fields.="\n\t\t";
                $Fields.="<div id=\"cmsDynText_".$Data."\" class=\"cmsDynText\">".make_cms_type("CMS_HTML",$Data)."</div>";
            }
        }
    }
}
echo $Fields;
?>
</div>
Das Modul wird normal installiert.
1. Neues Modul anlegen
2. Modul Input in den Input bereich
3. Modul Output in den Outputbereich
4. Modul ins Template einbinden

Die Überschriften sind als h3 definiert.
Hinterlegt sind als CSS Klassen und ID´s.
Die ID´s sind natürlich einmalig pro eintrag vergeben.

Theoretisch kann man es auch einfach um weitere CMS-Typen erweitern.
Hier muss im Inputbereich das Select erweitert:

Code: Alles auswählen

            <select name="<?php echo "CMS_VAR[$fVarTempArt]";?>" onChange="<?php echo $sSubmitOnchange; ?>">
                    <option value="cmshead"     <?php if($fValueTempArt=="cmshead"){echo "selected";}else{echo "";}?>>      <?php echo mi18n("&Uuml;berschrift");?></option>
                    <option value="cmshtml"     <?php if($fValueTempArt=="cmshtml"){echo "selected";}else{echo "";}?>>      <?php echo mi18n("Textbereich");?></option>
            </select>

Und dementsprechend auch der Outputbereich in der Schleife angepasst werden:

Code: Alles auswählen

            if($Field=="cmshead"){
                $Fields.="\n\t\t";
                $Fields.="<div id=\"cmsDynHeadline_".$Data."\" clas=\"cmsDynHeadline\"><h3>".make_cms_type("CMS_HTMLHEAD",$Data)."</h3></div>";
            }
            if($Field=="cmshtml"){
                $Fields.="\n\t\t";
                $Fields.="<div id=\"cmsDynText_".$Data."\" class=\"cmsDynText\">".make_cms_type("CMS_HTML",$Data)."</div>";
            }
Weitere CMS-Typen findet man zum Beispiel hier:
http://www.contenido-wiki.org/wiki/inde ... ent.2Cn.29

Dann mal viel Spass damit.

schöne Grüße von Usedom
Ralf
Schöne Grüße von Usedom
Ralf

McHubi
Beiträge: 1210
Registriert: Do 18. Nov 2004, 23:06
Wohnort: Mettmann
Kontaktdaten:

Re: xtcDynCmsContainer Dynamisches CMS_HTML und CMS_HTMLHEAD

Beitrag von McHubi » Mo 22. Okt 2012, 12:10

Gefällt mir! Danke Dir! :D
seamless-design.de
"Geht nicht!" wohnt in der "Will nicht!"-Strasse.

Das Handbuch zur Version 4.10: CONTENIDO für Einsteiger (4.10)

Das Handbuch zur Version 4.9: CONTENIDO für Einsteiger (4.9)

Gesperrt