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:
ergibt im Editor
bzw. dann im Quelltext
Code: Alles auswählen
<div id="headline"></div>
<div id="text"></div>
<div id="text"></div>
<div id="text"></div>
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> <?php echo mi18n("Anzahl der Felder:");?> </td>
<td style="border-left:1px solid #e2e2e2;" colspan="3"> <input type="text" name="CMS_VAR[10]" value="CMS_VALUE[10]" size="3" />
<?php echo mi18n("speichern");?> <?php echo $sSubmitLink;?> </td>
</tr>
<tr>
<td style="background:#f1f1f1;border-top:1px solid #e2e2e2;border-bottom:1px solid #e2e2e2;"> </td>
<td colspan="3" style="background:#f1f1f1;border-left:1px solid #e2e2e2;border-top:1px solid #e2e2e2;border-bottom:1px solid #e2e2e2;"> <?php echo mi18n("Type");?> </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" /> </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("Überschrift");?></option>
<option value="cmshtml" <?php if($fValueTempArt=="cmshtml"){echo "selected";}else{echo "";}?>> <?php echo mi18n("Textbereich");?></option>
</select>
</td>
</tr>
<?php
}
}
?>
</table>
<?php
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 = " ";
}
$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 = " ";
}
$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>