Ich hab mich nochmal durchgefranzt...
Der Fehler liegt nicht in der Funktion make_cms_type(). Eher aber in der Filelistclass.
Die public function getAllWidgetView() in der class Cms_FileList gibt ihren sprintf falsch aus/bricht ab:
Code: Alles auswählen
public function getAllWidgetView() {
$sCode = '\";?><?php
$oFileList = new Cms_FileList(\'%s\', %s, 0, "", $cfg, null, "", $client, $lang, $cfgClient, null);
echo $oFileList->getAllWidgetOutput();
?><?php echo \"';
$sCode = sprintf($sCode, $this->sContent, $this->iId);
return $sCode;
}
hier kommt nur ein abgebrochenes Stückchen raus, nämlich das (siehe vorheriger Beitrag):
Da ich mit make_cms_type('CMS_FILELIST',1) sowieso nur an die Schaltfläche zur Auswahl der Dateien und Sortierung ranwill, habe ich in der class die Function getAllWidgetEdit() kopiert, umbenannt und den Aufruf der getAllWidgetView() deaktivert:
Code: Alles auswählen
public function getAllWidgetEdit() {
/* ... */
$sCode = $oTpl->generate($this->aCfg['path']['contenido'].'templates/standard/template.cms_filelist_edit.html', 1);
return $this->getAllWidgetView( true ) . $this->encodeForOutput($sCode);
}
public function getAllWidgetEdit2() {
/* ... */
$sCode = $oTpl->generate($this->aCfg['path']['contenido'].'templates/standard/template.cms_filelist_edit.html', 1);
//alt: return $this->getAllWidgetView( true ) . $this->encodeForOutput($sCode);
return $this->encodeForOutput($sCode);
}
Am Core rumbasteln ist nicht updatesicher... trotzdem muss ich das so machen.
Dadurch die Funktion make_cms_type() in der DB nachschaut, wie das CMS_Element aufgebaut ist, habe ich diese angepasst:
Code: Alles auswählen
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");
/*neu*/
if($container_type=='CMS_FILELIST') {
//function getAllWidgetEdit2() has another return val
$cms_code = str_replace('getAllWidgetEdit()','getAllWidgetEdit2()', $cms_code);
}
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;
}
Damit bekomme ich die Schaltfläche für die Filelist. Funktioniert super.
Dadurch ich aber jetzt an der Class Änderungen gemacht habe, suche ich immer noch nach einer Lösung, die besser ist.
Ist das sprintf wirklich kaputt? Oder wird das nur bei mir falsch ausgegeben?
Und wieso existiert diese Funktion so überhaupt?
Naja,
qualtext.