Verfasst: Mi 18. Apr 2007, 08:30
Schau auf Seite 3 dieses Thread und probier aus ob das den Fehler produziert.Heru hat geschrieben:... indem du mir den "richtigen" aus den 74 einfach direkt nennst!
Das Diskussionsforum zum Open Source Content Management System
https://forum.contenido.org/
Schau auf Seite 3 dieses Thread und probier aus ob das den Fehler produziert.Heru hat geschrieben:... indem du mir den "richtigen" aus den 74 einfach direkt nennst!
Code: Alles auswählen
$navigation->showNavigation(1);Code: Alles auswählen
<container id="40" name="Navi Geteilt" types="Navigation" mode="optional" default="Navi Geteilt">Navi Geteilt</container>Code: Alles auswählen
<container id="44" name="Navi Geteilt 1" types="Navigation" mode="optional" default="Navi Geteilt 1">Navi Geteilt 1</container>Code: Alles auswählen
Fatal error: Call to a member function on a non-object in /srv/www/vhosts/smoco.de/httpdocs/contenido/cms/front_content.php(884) : eval()'d code on line 83Das Modul mit der Klasse "navigation" muss also dem Container zugewiesen werden, der zuerst im Quelltext (Layout) steht. Deshalb einfach mal in den beiden Modulen jeweils beiderjenige container, der als erstes abgearbeitet werden wird, sollte einfach die klasseninstantiierung vornehmen.
Code: Alles auswählen
$navigation->showNavigation(0);Code: Alles auswählen
<?php
/**
* $Revision: 1.22 $
* $Source: D:/cvs/cvsrepo/test/PPI_Nade/module/mainNavigation/output.php,v $
* $Date: 2005/11/28 10:20:39 $
*/
/**
* navigation
* @author Andreas Kummer
* @copyright Copyright © 2005 w3concepts AG
* modified by Ichier 17.5.07
* fixed & added recursion
*/
if (!class_exists('navigation')) {
class navigation {
/**
* Konstruktor der Klasse.
* @param Integer Primärschlüssel der Startkategorie.
*/
function navigation($startId) {
global $client, $lang, $idcat;
$this->startId = $startId;
$this->client = $client;
$this->lang = $lang;
$this->idcat = $idcat;
$this->before = '';
$this->beforeEach = '';
$this->between = '';
$this->after = '';
$this->db = new DB_Contenido();
$this->setStartIds();
$this->getNavigation();
$this->addcounterclass = false;
$this->counter = 0;
$this->recursive = false;
$this->recursive_cnt = 0;
$this->recursive_depth = 1;
$this->recursive_type = 'after';
$this->recursive_before = '';
$this->recursive_beforeEach = '';
$this->recursive_beforeSelected = '';
$this->recursive_between = '';
$this->recursive_after = '';
}
/**
* Auslesen der Navigationsstruktur aus der Datenbank.
*/
function getNavigation() {
global $cfg;
if ($this->startId != $this->id[0]) {
/*
* Wenn die StartId nicht identisch ist mit der höchsten Ebene der
* aktuell selektierten Kategorie, dann liegt die gewählte Kategorie
* folgerichtig ausserhalb des für die Navigation gewählten Baumes.
* In diesem Fall ist nur die Hauptnavigation einzublenden.
*/
$this->id[0] = $this->startId;
for ($i = 1; $i <= 3; $i++) {
$this->id[$i] = -1;
}
}
$this->db->query("" .
"SELECT " .
" a.idcat, " .
" a.parentid, " .
" a.preid, " .
" a.postid, " .
" a.parentid, " .
" b.visible, " .
" b.name, " .
" b.idlang " .
" FROM {$cfg['tab']['cat']} AS a " .
"INNER JOIN {$cfg['tab']['cat_lang']} AS b ON a.idcat = b.idcat " .
"WHERE " .
" b.idlang = ". $this->lang." " .
" AND a.idclient = {$this->client} " .
" AND (" .
" a.parentid = {$this->id[0]} " .
" OR a.parentid = {$this->id[1]} " .
" OR a.parentid = {$this->id[2]} " .
" OR a.parentid = {$this->id[3]} " .
" ) " .
"");
// sprachenbug ausm forum
/* " FROM {$cfg['tab']['cat']} AS a " .
"LEFT JOIN {$cfg['tab']['cat_lang']} AS b ON a.idcat = b.idcat " .
"WHERE " .
" a.idclient = {$this->client} " .
" AND (" .
" a.parentid = {$this->id[0]} " .
" OR a.parentid = {$this->id[1]} " .
" OR a.parentid = {$this->id[2]} " .
" OR a.parentid = {$this->id[3]} " .
" ) " .
"");*/
$this->navigationTree = array();
$this->firstId[0] = 0;
$this->firstId[1] = 0;
$this->firstId[2] = 0;
$this->firstId[3] = 0;
while ($this->db->next_record()) {
for ($i = 0; $i <= 3; $i++) {
if (($this->firstId[$i] == 0 && $this->db->f('parentid') == $this->id[$i] && $this->db->f('preid') == 0 && $this->db->f('idlang') == $this->lang) || ($this->firstId[$i] == 0 && $this->db->f('parentid') == $this->id[$i] && $this->db->f('preid') == 0 && $this->db->f('idlang') == null)) {
$this->firstId[$i] = $this->db->f('idcat');
}
}
$this->navigationTree[$this->db->f('parentid')][$this->db->f('idcat')] = array('preid'=>$this->db->f('preid'), 'postid'=>$this->db->f('postid'), 'visible'=>$this->db->f('visible'), 'name'=>$this->db->f('name'), 'idlang'=>$this->db->f('idlang'));
}
}
/**
* Rekursives Aufrufen, zwischenspeichern der aktuellen Werte
* Ichier 2007
*/
function ShowRecursive($type) {
$bkp_counter = $this->counter;
$bkp_before = $this->before;
$bkp_beforeEach = $this->beforeEach;
$bkp_beforeSelected = $this->beforeSelected;
$bkp_between = $this->between;
$bkp_after = $this->after;
$this->before = $this->recursive_before;
$this->beforeEach = $this->recursive_beforeEach;
$this->beforeSelected = $this->recursive_beforeSelected;
$this->between = $this->recursive_between;
$this->after = $this->recursive_after;
$this->recursive_cnt++;
$this->showNavigation($type+1);
$this->recursive_cnt--;
$this->before = $bkp_before;
$this->beforeEach = $bkp_beforeEach;
$this->beforeSelected = $bkp_beforeSelected;
$this->between = $bkp_between;
$this->after = $bkp_after;
$this->counter = $bkp_counter;
}
/**
* Ausgabe der Navigation an die Standardausgabe.
* @param String Navigationstyp
*/
function showNavigation($type, $next = -1) {
static $first;
static $output = false;
if ($next == 0) {
echo $this->after; //modified as posted in forum, fixes no-after-bug
return false;
}
if ($next == -1) {
$this->counter = 0;
echo $this->before;
$next = $this->firstId[$type];
$first = true;
}
$parentId = $this->id[$type];
$link = 'front_content.php?idcat='.$next;
if ($this->navigationTree[$parentId][$next]['visible'] == 1 && $this->navigationTree[$parentId][$next]['idlang'] == $this->lang) {
if (!$first) {
echo $this->between;
}
if ($this->isSelected($next)) {
if($this->recursive && $this->recursive_cnt<$this->recursive_depth && $this->recursive_type=='before') {
$this->ShowRecursive($type);
}
echo $this->beforeSelected;
} else {
echo $this->beforeEach;
}
if($this->addcounterclass) {
$this->counter++;
switch($this->counter) {
case 1 : $cssclassadd = 'eins'; break;
case 2 : $cssclassadd = 'zwei'; break;
case 3 : $cssclassadd = 'drei'; break;
case 4 : $cssclassadd = 'vier'; break;
case 5 : $cssclassadd = 'fuenf'; break;
case 6 : $cssclassadd = 'sechs'; break;
case 7 : $cssclassadd = 'sieben'; break;
case 8 : $cssclassadd = 'acht'; break;
case 9 : $cssclassadd = 'neun'; break;
case 10 : $cssclassadd = 'zehn'; break;
}
$cssclassadd = ' class="'.$cssclassadd.'"';
}
echo '<a href="'.$link.'"'.$cssclassadd.'>'.$this->navigationTree[$parentId][$next]['name'].'</a>';
$first = false;
$output = true;
if($this->isSelected($next) && $this->recursive && $this->recursive_cnt<$this->recursive_depth && $this->recursive_type=='after') {
$this->ShowRecursive($type);
}
} elseif (!$output && $this->navigationTree[$parentId][$next]['postid'] == 0) {
/*
* Die Navigation enthält nichts.
*/
echo 'nada ';
}
$this->showNavigation($type, $this->navigationTree[$parentId][$next]['postid']);
}
/**
* Ausgabe vor der Navigation
* @param String Ausgabe vor der Navigation.
*/
function before($text) {
$this->before = $text;
}
/**
* Ausgabe vor jedem Eintrag
* @param String Ausgabe vor jedem Eintrag.
*/
function beforeEach($text) {
$this->beforeEach = $text;
}
/**
* Ausgabe vor jedem selektierten Menueintrag
* @param String Ausgabe vor jedem selektierten Menueintrag.
*/
function beforeSelected($text) {
$this->beforeSelected = $text;
}
/**
* Ausgabe zwischen zwei Hauptmenupunkten
* @param String Ausgabe zwischen zwei Hauptmenupunkten.
*/
function between($text) {
$this->between = $text;
}
/**
* Ausgabe nach der Navigation
* @param String Ausgabe nach der Navigation.
*/
function after($text) {
$this->after = $text;
}
/**
* Gibt das Level der Kategorie zurück.
* @param Integer Primärschlüssel der Kategorie.
* @return Integer Level der spezifizierten Kategorie.
*/
function getLevel($idcat) {
global $cfg;
if (empty($idcat)) {
return 0;
}
$this->db->query("" .
"SELECT level FROM {$cfg['tab']['cat_tree']} " .
"WHERE " .
" idcat = $idcat" .
"");
if ($this->db->next_record()) {
return $this->db->f('level');
} else {
return 0;
}
}
/**
* Gib die Tiefe relativ zum Hauptmenu an.
* @param Integer Primärschlüssel der Kategorie
* @return Integer Level relativ zum Hauptmenu
*/
function getNetLevel($idcat) {
return $this->getLevel($idcat) - $this->getLevel($this->startId);
}
/**
* Ermittlung des jeweils ersten Kategorieeintrages jeder Ebene. Die
* Speicherung dieser Daten erfolgt in das Klassenattribut id.
*/
function setStartIds() {
$id = $this->idcat;
$level = $this->getNetLevel($id);
$this->id[$level] = $id;
while ($level > 0) {
$this->id[$level-1] = $this->getParentId($id);
$id = $this->id[$level-1];
$level = $this->getNetLevel($id);
}
if (empty($this->id)) {
$this->id[0] = $this->startId;
}
for ($i = 1; $i <= 3; $i++) {
if (empty($this->id[$i])) {
$this->id[$i] = -1;
}
}
ksort($this->id);
}
/**
* Ermittlung des Elternelementes der Kategorie mit dem Primärschlüssel
* idcat
* @param Integer Primärschlüssel des Kindelementes, dessen Elternelement
* ermittelt werden soll.
* @return Integer Primärschlüssel des Elternelementes.
*/
function getParentId($idcat) {
global $cfg;
$this->db->query("" .
"SELECT parentid FROM {$cfg['tab']['cat']} " .
"WHERE " .
" idcat = $idcat " .
"");
if ($this->db->next_record()) {
return $this->db->f('parentid');
} else {
return 0;
}
}
/**
* Anzeige, ob eine Navigationsebene Elemente enthält oder nicht.
* @param Integer Navigationsstufe.
* @return Boolean True, wenn die Navigationsstufe leer ist (keine Elemente
* enhält). Sonst false.
*/
function navigationEmpty($level) {
if ($this->firstId[$level] == 0) {
return true;
}
return false;
}
/**
* Anzeige, ob eine Kategorie selektiert ist oder nicht. Eine Kategorie gilt
* als selektiert, wenn sie die aktuelle Kategorie ist oder ein direktes
* oder indirektes Elternelement der aktuellen Kategorie.
* @param Integer Primärschlüssel der Kategorie, deren Status gefragt ist.
* @return Boolean True, wenn die gefragte Kategorie mit der aktuellen
* Kategorie übereinstimmt oder ein direktes oder indirektes Elternelement
* der aktuellen Kategorie darstellt.
*/
function isSelected($idcat) {
return in_array($idcat, $this->id);
}
}
}
?>
Code: Alles auswählen
// class="eins" etc.
$navigation->addcounterclass = true;
// rekursion
$navigation->recursive = true; //aktivieren
$navigation->depth = 2; //maximale tiefe
$navigation->recursive_type = 'after'; //vor oder nach dem aktivem übermenu-link
$navigation->recursive_before = '<ul class="sub">';
$navigation->recursive_beforeEach = '<li>';
$navigation->recursive_beforeSelected= '<li class="aktiv">';
$navigation->recursive_between = '</li>';
$navigation->recursive_after = '</li></ul>';
Code: Alles auswählen
<?php
// Settings
cInclude('classes', 'atelierq.navigation.class.inc.php');
$cApiClient = new cApiClient($client);
$aQnavigation = new aQnavigation(1); // id der hauptkategorie
// SUBMENU
$aQnavigation->between(1, '');
$aQnavigation->maskNormal(1, '<div class="submenu"><a target="_self" href="{link}">{name1}</a></div>');
$aQnavigation->maskSelected(1, '<div class="submenu_offen"><a target="_self" href="{link}">{name1}</a></div>');
$aQnavigation->maskSelectedSub(1, '<div class="submenu"><a target="_self" href="{link}">{name1}</a></div>{sub}');
$aQnavigation->setSub(1, $aQnavigation->showNavigation(2));
// SUBSUB MENU
$aQnavigation->between(2, '');
$aQnavigation->maskNormal(2, '<div class="subsubmenu"><a target="_self" href="{link}">{name1}</a></div>');
$aQnavigation->maskSelected(2, '<div class="subsubmenu_offen"><a target="_self" href="{link}">{name1}</a></div>');
$aQnavigation->maskSelectedSub(2, '<div class="subsubmenu"><a target="_self" href="{link}">{name1}</a></div>{sub}');
$aQnavigation->setSub(2, $aQnavigation->showNavigation(3));
// AUSGEBEN!
echo $aQnavigation->showNavigation(1);
echo $aQnavigation->showNavigation(2);
?> Code: Alles auswählen
$navigation->addcounterclass = false;
$navigation->before('<p id="supDescription">Beispiele</p><ul class="sup">');
$navigation->beforeEach('<li>');
$navigation->beforeSelected('<li class="current">');
$navigation->between('</li>');
$navigation->after('</li></ul>');Code: Alles auswählen
$output = $navigation->showNavigation(2);
if (strlen(trim($output) > 0) {
echo '<ul>';
echo $output;
echo '</ul>';
}