Dyn. CMS_HTML und CMS_HTMLHEAD

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

Dyn. CMS_HTML und CMS_HTMLHEAD

Beitrag von yodatortenboxer » Mo 14. Jul 2008, 12:05

Hiho,

hab mal wieder etwas für einen Kunden gebraucht.

Im folgenden Modul kann man im Inputbereich eine Felderanzahl und nach dem Speichern über den blauen Pfeil, danach bei den Felder entweder Überberschift oderTextbereich auswählen.

Beispiel:

Bild

ergibt im Editor

Bild
bzw. dann im Quelltext

Code: Alles auswählen

<div id="headline"></div>
<div id="text"></div>
<div id="text"></div>
<div id="text"></div>
Das ganze gibt es hier:
http://www.xtended-cooperation.de/werbe ... ainer.html

oder direkt hier

Modulinput:

Code: Alles auswählen

?><?php
/***********************************************
* Dynamisches CMS_HTML und CMS_HTMLHEAD
* 
* Inputbereich
*
* Author      :     Ralf Fleischer
* Copyright   :     xtended cooperation
* Mail        :     info@xtended-coperation.de
* Created     :     14-07-2008
* Version     :     0.0.2
* Modified    :     14-07-2008
************************************************/

$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
ModulOutput:

Code: Alles auswählen

<?php
/***********************************************
* Dynamisches CMS_HTML und CMS_HTMLHEAD
* 
* Outputbereich
*
* Author      :     Ralf Fleischer
* Copyright   :     xtended cooperation
* Mail        :     info@xtended-coperation.de
* Created     :     14-07-2008
* Version     :     0.0.2
* Modified    :     14-07-2008
************************************************/

########################################################            
################## 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 ##################
################################################    

function xtcCmsHtmlHead($val){
    global $db;
    global $client;
    global $lang;
    global $cfg;
    global $area_tree;
    global $sess;
    global $perm;
    global $area_rights;
    global $item_rights;
    global $_SESSION;
    global $remakeCatTable;
    global $remakeStrTable;
    global $auth;
    global $tpl;
    global $edit;
    global $a_content;
    global $idartlang;
    global $idcat;
    global $idart;
    
    /**
    * CMS_HTMLHEAD
    */ 
    $tmp = $a_content['CMS_HTMLHEAD'][$val];
    $tmp = urldecode($tmp); 
    
    if ($edit) {
        if ($tmp == "") { 
            $tmp = "&nbsp;"; 
        } 
        $insiteEditingDIV = new cHTMLDiv; 
        $insiteEditingDIV->setId("HTMLHEAD_".$db->f("idtype")."_".$val);
        $insiteEditingDIV->setEvent("Focus", "this.style.border='1px solid #bb5577';"); 
        $insiteEditingDIV->setEvent("Blur", "this.style.border='1px dashed #bfbfbf';"); 
        $insiteEditingDIV->setStyleDefinition("border", "1px dashed #bfbfbf"); 
        $insiteEditingDIV->setStyleDefinition("direction", langGetTextDirection($lang)); 
        
        $insiteEditingDIV->updateAttributes(array("contentEditable" => "true")); 
        
        $insiteEditingDIV->setContent("_REPLACEMENT_"); 
        
    
        /* Edit anchor and image */ 
        $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_HTMLHEAD&typenr=$val");
        $editAnchor = new cHTMLLink; 
        $editAnchor->setLink("javascript:setcontent('$idartlang','" . $editLink . "');"); 
        
        $editButton = new cHTMLImage; 
        $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_edithead.gif");
        $editButton->setBorder(0); 
        $editButton->setStyleDefinition("margin-right", "2px"); 
            
        $editAnchor->setContent($editButton); 
        
        
        /* Save anchor and image */ 
        $saveAnchor = new cHTMLLink; 
        $saveAnchor->setLink("javascript:setcontent('$idartlang','0')"); 
        
        $saveButton = new cHTMLImage; 
        $saveButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_ok.gif"); 
        $saveButton->setBorder(0); 
        
        $saveAnchor->setContent($saveButton); 
    
        /* Process for output with echo */ 
        $finalEditButton = $editAnchor->render(); 
        $finalEditingDiv = $insiteEditingDIV->render(); 
        $finalEditingDiv = str_replace("_REPLACEMENT_", $tmp, $finalEditingDiv); 
        $finalSaveButton = $saveAnchor->render(); 
        
        return  $finalEditingDiv . $finalEditButton . $finalSaveButton;
    }else{
        $text = new Article($idart, $client, $lang);
        $msgText = $text->getContent("CMS_HTMLHEAD", $val);
        return $msgText;
    }
}
function xtcCmsHtml($val){
    global $db;
    global $client;
    global $lang;
    global $cfg;
    global $area_tree;
    global $sess;
    global $perm;
    global $area_rights;
    global $item_rights;
    global $_SESSION;
    global $remakeCatTable;
    global $remakeStrTable;
    global $auth;
    global $tpl;
    global $edit;
    global $a_content;
    global $idartlang;
    global $idcat;
    global $idart;
    
    /** 
     * CMS_HTML 
     */ 
    $tmp = $a_content['CMS_HTML'][$val]; 
    $tmp = urldecode($tmp); 
    
    if ($edit) { 
        if ($tmp == "") { 
            $tmp = "&nbsp;"; 
        } 
        $insiteEditingDIV = new cHTMLDiv; 
        $insiteEditingDIV->setId("HTML_".$db->f("idtype")."_".$val); 
        $insiteEditingDIV->setEvent("Focus", "this.style.border='1px solid #bb5577';"); 
        $insiteEditingDIV->setEvent("Blur", "this.style.border='1px dashed #bfbfbf';"); 
        $insiteEditingDIV->setStyleDefinition("border", "1px dashed #bfbfbf"); 
        $insiteEditingDIV->setStyleDefinition("direction", langGetTextDirection($lang)); 
        
        $insiteEditingDIV->updateAttributes(array("contentEditable" => "true")); 
        
        $insiteEditingDIV->setContent("_REPLACEMENT_"); 
    
        /* Edit anchor and image */ 
        $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_HTML&typenr=$val"); 
        $editAnchor = new cHTMLLink; 
        $editAnchor->setLink("javascript:setcontent('$idartlang','" . $editLink . "');"); 
        
        $editButton = new cHTMLImage; 
        $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_edithtml.gif"); 
        $editButton->setBorder(0); 
        $editButton->setStyleDefinition("margin-right", "2px"); 
            
        $editAnchor->setContent($editButton); 
        
        /* Save anchor and image */ 
        $saveAnchor = new cHTMLLink; 
        $saveAnchor->setLink("javascript:setcontent('$idartlang','0')"); 
        
        $saveButton = new cHTMLImage; 
        $saveButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_ok.gif"); 
        $saveButton->setBorder(0); 
        
        $saveAnchor->setContent($saveButton); 
    
        /* Process for output with echo */ 
        $finalEditButton = $editAnchor->render(); 
        $finalEditingDiv = $insiteEditingDIV->render(); 
        $finalEditingDiv = str_replace("_REPLACEMENT_", $tmp, $finalEditingDiv); 
        $finalSaveButton = $saveAnchor->render(); 
        
        return $finalEditingDiv . $finalEditButton . $finalSaveButton;
    }else{
        $text = new Article($idart, $client, $lang);
        $msgText = $text->getContent("CMS_HTML", $val);
        return $msgText; 
    }
}

#########################################################################            
################## 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=\"headline\"><h3>".xtcCmsHtmlHead($Data)."</h3></div>";
            }
            if($Field=="cmshtml"){
                $Fields.="\n\t\t";
                $Fields.="<div id=\"text\">".xtcCmsHtml($Data)."</div>";
            }
        }
    }
}
echo $Fields;
?>
</div>
gruß yodatortenboxer

OliverL
Beiträge: 870
Registriert: Do 28. Jun 2007, 09:28
Kontaktdaten:

Beitrag von OliverL » Mi 16. Jul 2008, 12:17

Hi,

Nettes Modul.

Aber wäre es nicht Version's unabhängiger wenn du den Quelltext aus der Datenbank holst und den dann in den Funktionen ausführst?

mfg OliverL
Zuletzt geändert von OliverL am Fr 10. Okt 2008, 21:20, insgesamt 1-mal geändert.

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

Beitrag von yodatortenboxer » Mi 16. Jul 2008, 13:02

Aber währe es nicht Version's unabhängiger wenn du den Quelltext aus der Datenbank holst und den dann in den Funktionen ausführst?
Definitiv Yep...werd ich auch mal machen wenn ich wieder mehr zeit habe. So ging es für mich in dem Augenblick schneller.

Gruß yodatortenboxer

aSoahc
Beiträge: 49
Registriert: Fr 6. Feb 2009, 13:55
Kontaktdaten:

Re: Dyn. CMS_HTML und CMS_HTMLHEAD

Beitrag von aSoahc » Mi 29. Apr 2009, 15:04

Hi yodatortenboxer,

ich habe mir gerade dein Modul angeschaut, da ich mir quasi ein Modul manuell zusammengebaut habe, was man ja eigentlich so toll mit deinem dynamisch machen kann. :D

Vielleicht könnte man in eine zukünfigten Version auch Bilder in die dynamische Konfiguration mit aufnehmen. *nur als Vorschlag*

Gruß aSoahc

OliverL
Beiträge: 870
Registriert: Do 28. Jun 2007, 09:28
Kontaktdaten:

Re: Dyn. CMS_HTML und CMS_HTMLHEAD

Beitrag von OliverL » Mi 29. Apr 2009, 15:10

Ohhh haaaa....
Hatte den Beitrag schon voll vergessen.

zu meinem Letzten Post gibt es ne Neuerung.
OliverL hat geschrieben:Aber wäre es nicht Version's unabhängiger wenn du den Quelltext aus der Datenbank holst und den dann in den Funktionen ausführst?
Resultat findet man unter:
http://www.contenido-wiki.org/wiki/inde ... ent.2Cn.29

mfg OliverL

Gesperrt