Modul Accordion

Gesperrt
andy-man
Beiträge: 166
Registriert: Di 25. Nov 2003, 11:29
Wohnort: Oberstaufenbach
Kontaktdaten:

Modul Accordion

Beitrag von andy-man » Fr 4. Mär 2011, 14:01

Hallo,
hier ein neues Modul "Accordion" das yodatortenboxer entwickelt hat und wir können dies im Forum veröffentlichen.
Das Modul ist aufgebaut auf der Grundlage vom Modul "xtcDynCmsContainer".
http://www.werbeagentur-usedom.de/xtend ... ainer.html

Die Installaltion ist sehr einfach. Das Modul importieren, ins Template zuordnen und die js- und css-Dateien in die entsprechenden Verzeichnisse kopieren.
konfiguration.jpg
Templatekonfiguration
konfiguration.jpg (18.14 KiB) 3254 mal betrachtet
Zu sehen unter http://neu.frauenarzt-kl.de/ bei den Sprechzeiten.

Hier der Input:

Code: Alles auswählen

?><?php
/***********************************************
* Dynamisches CMS_HTML und CMS_HTMLHEAD jQuery Accordeon
* 
* Inputbereich
*
* Author      :     Ralf Fleischer
* Copyright   :     xtended cooperation
* Mail        :     info@xtended-coperation.de
* Created     :     01-12-2010
* Version     :     0.0.1
************************************************/

$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();';

?>
<table style="border:1px solid #e2e2e2" cellpadding="0" cellspacing="0" border="0">
    <tr>
        <td>&nbsp;<?php echo mi18n("Anzahl der Bereiche:");?>&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;</td>
    </tr>
    <tr>
        <td>&nbsp;<?php echo mi18n("StartId (Bsp: 5 für CMS_HTML[5]):");?>&nbsp;</td>
        <td style="border-left:1px solid #e2e2e2;" colspan="3">&nbsp;<input type="text" name="CMS_VAR[11]" value="CMS_VALUE[11]" size="3" />&nbsp;</td>
    </tr>
    <tr>
        <td>&nbsp;<?php echo mi18n("Startfenster (Bsp: 1 für zweites geöffnet):");?>&nbsp;</td>
        <td style="border-left:1px solid #e2e2e2;" colspan="3">&nbsp;<input type="text" name="CMS_VAR[12]" value="CMS_VALUE[12]" size="3" />&nbsp;</td>
    </tr>
    <tr>
        <td>&nbsp;<?php echo mi18n("Animation:");?>&nbsp;</td>
        <td style="border-left:1px solid #e2e2e2;" colspan="3">&nbsp;<input <?php if("CMS_VALUE[13]"==true){echo "checked=\"checked\"";}?> type="checkbox" name="CMS_VAR[13]" value="true" />&nbsp;</td>
    </tr>
    <tr>
        <td>&nbsp;<?php echo mi18n("Automatische Höhe:");?>&nbsp;</td>
        <td style="border-left:1px solid #e2e2e2;" colspan="3">&nbsp;<input <?php if("CMS_VALUE[14]"==true){echo "checked=\"checked\"";}?> type="checkbox" name="CMS_VAR[14]" value="true" />&nbsp;</td>
    </tr>
    <tr>
        <td>&nbsp;<?php echo mi18n("Event Mouseover:");?>&nbsp;</td>
        <td style="border-left:1px solid #e2e2e2;" colspan="3">&nbsp;<input <?php if("CMS_VALUE[15]"==true){echo "checked=\"checked\"";}?> type="checkbox" name="CMS_VAR[15]" value="true" />&nbsp;</td>
    </tr>
    <tr>
        <td align="right" style="background:#f1f1f1;border-top:1px solid #e2e2e2;border-bottom:1px solid #e2e2e2;">&nbsp;Speichern&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 $sSubmitLink;?>&nbsp;</td>
    </tr>
</table>
<?php
der Output

Code: Alles auswählen

<?php
/***********************************************
* Dynamisches CMS_HTML und CMS_HTMLHEAD jQuery Accordeon
* 
* Outputbereich
*
* Author      :     Ralf Fleischer
* Copyright   :     xtended cooperation
* Mail        :     info@xtended-coperation.de
* Created     :     01-12-2010
* Version     :     0.0.1
************************************************/

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

$fValueOut="CMS_VALUE[10]";
$fValueStartId="CMS_VALUE[11]";
$fActive="CMS_VALUE[12]";
$fBounceslide="CMS_VALUE[13]";
$fAutoHeight="CMS_VALUE[14]";
$fEvent="CMS_VALUE[15]";

if($fValueOut==""){$fValueOut=1;}
if($fValueStartId==""){$fValueStartId=2;}
if($fActive==""){$fActive=1;}
if($fBounceslide==true){$fBounceslide="bounceslide";}else{$fBounceslide="slide";}
if($fAutoHeight==true){$fAutoHeight="true";}else{$fAutoHeight="false";}
if($fEvent==true){$fEvent="mouseover";}else{$fEvent="click";}

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

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

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

function xtcCmsHtmlHeadjQueryAccordeon($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 xtcCmsHtmljQueryAccordeon($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; 
    }
}

################################################
################## Javascript ##################
################################################

if(!$contenido){
 ?>

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
<script type="text/javascript">
  $(document).ready(function() {
    $("#accordion").accordion({
		active: <?php echo $fActive; ?>,
		animated: '<?php echo $fBounceslide; ?>',
		autoHeight: <?php echo $fAutoHeight; ?>,
		event: '<?php echo $fEvent; ?>'
    });
  });
</script>
<?php

$requestUri = $_SERVER['REQUEST_URI'];
$LinkStart="<a href='$requestUri#top'>";
$LinkEnde="</a>";
}

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

?>

<div id="accordion">
<?php
for($i=1;$i<=$fValueOut;$i++){	?>
    <h3><?php echo $LinkStart.xtcCmsHtmlHeadjQueryAccordeon($fValueStartId+$i).$LinkEnde; ?></h3>
    <div><?php echo xtcCmsHtmljQueryAccordeon($fValueStartId+$i); ?></div>
<?php
}
?>
</div>
Alle notwendigen Dateien könnt ihr als zip-File hier herunterladen.
Viel Freude damit.

andy-man
Dateianhänge
xtcAccordion.zip
(79.6 KiB) 272-mal heruntergeladen

helgaK
Beiträge: 18
Registriert: Mo 16. Feb 2009, 22:58
Kontaktdaten:

Re: Modul Accordion

Beitrag von helgaK » So 7. Aug 2011, 14:38

Hallo andy-man,
das ist wirklich ein prima Modul!! Vielen, vielen Dank dafür!! und da es so gut ist, würde ich es gerne mehrfach auf einer Seite verwenden, dann gibt es aber - und logischerweise - eine Fehlermeldung, dass die Anwendung schon existiert und nicht noch einmal declariert werde könne. Als nicht PHPlerin stehe ich nun auf dem Schlauch... Ich weiß, dass man mit "if function exists" u.ä.m. was machen kann, aber leider nicht, wo und wie ich es in diesem Modul einbauen müsste.

Könntest du mir auf die Sprünge helfen? Wäre toll!
Danke schon mal im Voraus und viele Grüße
Helga

===> nun habe ich mich noch intensiver mit dem Modul beschäftigt... mein Problem: ich möchte es u.a. als Article include über das Standard Template im rechten Teaserbereich nutzen, also gleichzeitig auf mehreren Seiten. ist das überhaupt möglich mit diesem Aufbau? So wie ich es jetzt verstehe muss man Inhalte für das Accordeon pro Seite eingeben oder?

Dieses Thema hat höhere Priorität als das obige. Wäre ganz wunderbar, wenn du mir was dazu sagen könntest. Falls ich es nicht 'global' einsetzen kann, muss ich mir eh etwas anderes überlegen...
Danke und viele Grüße
Helga

Gesperrt