Kann mir jemand helfen ? Ich würde gern wissen Wo die navigation festlegt wo welcher artikel zugehörig ist.
Also zb icat:1 und wo ist die verbindung zu den dazugehörigen Artikeln ?
Danke
DB abfrage
Re: DB abfrage
Also "die Navigation" gibts ja in Contenido nicht. Meinst Du ein Modul? Wenn ja welches?cms hat geschrieben:Kann mir jemand helfen ? Ich würde gern wissen Wo die navigation festlegt wo welcher artikel zugehörig ist.
In der Tabelle con_cat_art wird festgelegt welcher Artikel (idart) in welcher Kategorie (idcat) liegt.cms hat geschrieben:Also zb icat:1 und wo ist die verbindung zu den dazugehörigen Artikeln ?
Das alleine hilft Dir aber warscheinlich noch nicht weiter. Zur Verbindung der einzelnen Tabellen schau Dir mal http://www.contenido.org/opensourcecms/ ... .model.pdf an.
Oder sag was Du konkret aus der Datenbank abfragen willst.
Bis dann
Tono
Tono
-
- Beiträge: 3626
- Registriert: Di 12. Okt 2004, 20:00
- Wohnort: Voerde (Niederrhein)
- Kontaktdaten:
Was du suchst, ist eine Artikelliste. Fertige Module gibt es z.B. hier:
http://www.contenido.org/forum/viewtopic.php?t=10957
http://www.contenido.org/forum/viewtopic.php?t=16232
Wenn du lieber selbst coden magst, gibt es hiermit einen einfachen Ansatz:
http://www.contenido.org/forum/viewtopi ... collection
http://www.contenido.org/forum/viewtopic.php?t=10957
http://www.contenido.org/forum/viewtopic.php?t=16232
Wenn du lieber selbst coden magst, gibt es hiermit einen einfachen Ansatz:
http://www.contenido.org/forum/viewtopi ... collection
so nein suche ich eben nicht, hab es aber jetzt schon gelöst . Falls es jemanden interessiert.
INPUT:
// selected category
$selected = "CMS_VALUE[0]";
echo "<table cellspacing=\"0\" cellpadding=\"10\" border=\"0\">
<tr valign=\"top\">
<td>Kategorie wählen:</td>
<td>
<select name=\"CMS_VAR[0]\">";
if($selected!="0" && $selected!=""){
echo"<option value=\"0\">--- kein ---</option>";
}else{
echo"<option selected=\"selected\" value=\"0\">--- kein ---</option>";
}
// fetch all categorys
$query = "SELECT A.idcat, A.level, C.name FROM ".$cfg["tab"]["cat_tree"]." AS A, ".
$cfg["tab"]["cat"]." AS B, ".$cfg["tab"]["cat_lang"]." AS C WHERE A.idcat=B.idcat ".
"AND B.idcat=C.idcat AND C.idlang='$lang' AND B.idclient='$client' ".
"AND C.visible=1 ORDER BY A.idtree";
// execute query
$db->query($query);
// loop result and build the options
while ($db->next_record()) {
// indent spacer
$spaces = "|";
// how many levels
$levels = $db->f("level");
for ($i = 0; $i < $levels; $i ++) {
// add 2 spaces for every level
$spaces = $spaces . "--";
} // end for
$spaces .= ">";
if ($selected == $db->f("idcat")) {
// selected category
echo "<option selected=\"selected\" value=\"". $db->f("idcat") ."\">". $spaces . $db->f("name") ."</option>";
} else {
// category
echo "<option value=\"". $db->f("idcat") ."\">". $spaces . $db->f("name") ."</option>";
} // end if
} // end while
echo " </select>";
echo " </td>
</tr>
echo $query;
</table>";
OUTPUT:
<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname : Hilfsnavigation
* Author(s) : Andreas Lindner
* Copyright : Contenido - four for business, Andreas Lindner
* Created : 05.08.2005 Modified CMS
************************************************/
cInclude("frontend", "includes/functions.navigation.php");
cInclude('classes', 'class.template.php');
$catStart = "CMS_VALUE[0]";
if(($catStart=='')||($catStart=='0')){
$cApiClient = new cApiClient($client);
$catStart= $cApiClient->getProperty('navigation', 'idcat_hilfsnavi');
}
if(!is_object($oClient)) {
$oClient = new cApiClient($client);
}
//echo '<ul>';
$navigation = array();
$navigation = createNavigationArray($catStart, $db);
if (count($navigation) > 0) {
$merkeids=array();
foreach ($navigation as $key => $data)
{
echo '<li><a href="'.$sess->url('front_content.php?idcat='.$data['idcat']).'">» '.$data['name'].'</a><li> ';
$sql = "SELECT * FROM con_cat_art WHERE idcat=".$key;
$db2->query($sql);
while ($db2->next_record())
{
$sql = "SELECT * FROM con_art_lang";
$db->query($sql);
while ($db->next_record())
{
if($db2->f(idart)==$db->f(idart)){ echo '<a href="front_content.php?idart='.$db->f(idart).'">'.$db->f(title).'</a>'; }
}
}
}
}
echo '</ul>';
?>
INPUT:
// selected category
$selected = "CMS_VALUE[0]";
echo "<table cellspacing=\"0\" cellpadding=\"10\" border=\"0\">
<tr valign=\"top\">
<td>Kategorie wählen:</td>
<td>
<select name=\"CMS_VAR[0]\">";
if($selected!="0" && $selected!=""){
echo"<option value=\"0\">--- kein ---</option>";
}else{
echo"<option selected=\"selected\" value=\"0\">--- kein ---</option>";
}
// fetch all categorys
$query = "SELECT A.idcat, A.level, C.name FROM ".$cfg["tab"]["cat_tree"]." AS A, ".
$cfg["tab"]["cat"]." AS B, ".$cfg["tab"]["cat_lang"]." AS C WHERE A.idcat=B.idcat ".
"AND B.idcat=C.idcat AND C.idlang='$lang' AND B.idclient='$client' ".
"AND C.visible=1 ORDER BY A.idtree";
// execute query
$db->query($query);
// loop result and build the options
while ($db->next_record()) {
// indent spacer
$spaces = "|";
// how many levels
$levels = $db->f("level");
for ($i = 0; $i < $levels; $i ++) {
// add 2 spaces for every level
$spaces = $spaces . "--";
} // end for
$spaces .= ">";
if ($selected == $db->f("idcat")) {
// selected category
echo "<option selected=\"selected\" value=\"". $db->f("idcat") ."\">". $spaces . $db->f("name") ."</option>";
} else {
// category
echo "<option value=\"". $db->f("idcat") ."\">". $spaces . $db->f("name") ."</option>";
} // end if
} // end while
echo " </select>";
echo " </td>
</tr>
echo $query;
</table>";
OUTPUT:
<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname : Hilfsnavigation
* Author(s) : Andreas Lindner
* Copyright : Contenido - four for business, Andreas Lindner
* Created : 05.08.2005 Modified CMS
************************************************/
cInclude("frontend", "includes/functions.navigation.php");
cInclude('classes', 'class.template.php');
$catStart = "CMS_VALUE[0]";
if(($catStart=='')||($catStart=='0')){
$cApiClient = new cApiClient($client);
$catStart= $cApiClient->getProperty('navigation', 'idcat_hilfsnavi');
}
if(!is_object($oClient)) {
$oClient = new cApiClient($client);
}
//echo '<ul>';
$navigation = array();
$navigation = createNavigationArray($catStart, $db);
if (count($navigation) > 0) {
$merkeids=array();
foreach ($navigation as $key => $data)
{
echo '<li><a href="'.$sess->url('front_content.php?idcat='.$data['idcat']).'">» '.$data['name'].'</a><li> ';
$sql = "SELECT * FROM con_cat_art WHERE idcat=".$key;
$db2->query($sql);
while ($db2->next_record())
{
$sql = "SELECT * FROM con_art_lang";
$db->query($sql);
while ($db->next_record())
{
if($db2->f(idart)==$db->f(idart)){ echo '<a href="front_content.php?idart='.$db->f(idart).'">'.$db->f(title).'</a>'; }
}
}
}
}
echo '</ul>';
?>