Template nur Laden wenn Inhalt vorhanden und default Inhalte

Gesperrt
nico65
Beiträge: 5
Registriert: Mi 6. Jan 2010, 16:38
Kontaktdaten:

Template nur Laden wenn Inhalt vorhanden und default Inhalte

Beitrag von nico65 »

Hi,

ich möchte gerne verschiedene Stellen auf der Seite editieren können und habe dafür dieses Modul hier im Forum gefunden.

Aber was muss ich ändern um das Template text_bottom.html nur zu laden wenn es einen Input gegeben hat.

außerdem würde mich interessieren, wie man es hin bekommt, dass es quasi einen Standard Text gibt, der auf jeder Seite automatisch erscheint, aber pro Seite auch überschrieben werden kann.

Code: Alles auswählen

<?php   
/**
* $RCSfile$
*
* Description: Output some HTML text
*
* @version 1.0.0
* @author Rudi Bieller
* @copyright four for business AG <www.4fb.de>
*
* {@internal
* created 2008-04-07
* }}
*
* $Id$
*/
if (!function_exists("make_cms_type")) {
    // HTML Container erstellen
    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;
    }   
}
    // Aufruf der Funktion 
//    echo make_cms_type("CMS_HTML","1");

//$TemCon = "CMS_HTML[$cCurrentContainer]";
$TemCon = make_cms_type("CMS_HTML",$cCurrentContainer);

if (!isset($tpl) || !is_object($tpl)) {
    $tpl = new Template();
}


$tpl->reset();
$tpl->set('s', 'text', $TemCon);
$tpl->generate('templates/text_bottom.html');
?>
Gruss Nico
nico65
Beiträge: 5
Registriert: Mi 6. Jan 2010, 16:38
Kontaktdaten:

Re: Template nur Laden wenn Inhalt vorhanden und default Inhalte

Beitrag von nico65 »

Ok, Problem 1 hab ich hinbekommen (gibt ja auch n paar Modul Beispiele, die abfragen ob ein Modul editiert wird oder ausgegeben)

Code: Alles auswählen

<?php   
/**
* $RCSfile$
*
* Description: Output some HTML text
*
* @version 1.0.0
* @author Rudi Bieller
* @copyright four for business AG <www.4fb.de>
*
* {@internal
* created 2008-04-07
* }}
*
* $Id$
*/
if (!function_exists("make_cms_type")) {
    // HTML Container erstellen
    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;
    }   
}
    // Aufruf der Funktion 
//    echo make_cms_type("CMS_HTML","1");

// $TemCon = "CMS_HTML[$cCurrentContainer]";
$TemCon = make_cms_type("CMS_HTML",$cCurrentContainer);

if (!isset($tpl) || !is_object($tpl)) {
    $tpl = new Template();
}

$tpl->reset();
if ($contenido && $edit) {
    $tpl->set('s', 'text', $TemCon);
    $tpl->generate('templates/text_bottom.html');
} else {
 if ($TemCon != '') {
	 $tpl->set('s', 'text', $TemCon);
	 $tpl->generate('templates/text_bottom.html');
	}
 }
?>
Gesperrt