Hallo,
VORWEG: Ich habe keine wirkliche PHP/SQL Kenntnis, deswegen tue ich mich so schwer.
Wollte gerade nach dieser schlauen Anleitung auch meine Hilfsnavi von idcat=xx auf path=xxxxx umstellen. Aber ohne Erfolg.
Die DB-Selektion und das Zwisschenspeichern funzt hier ganz anders.
Hat das zufällig schon mal wer angepackt, oder kann mir jemand erzaählen, wie ich diesen code anpassen muss:
input
Code: Alles auswählen
// 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>
</table>";
Output
Code: Alles auswählen
<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname : Hilfsnavigation
* Author(s) : Andreas Lindner
* Copyright : Contenido - four for business, Andreas Lindner
* Created : 05.08.2005
************************************************/
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);
}
$navigation = array();
$navigation = createNavigationArray($catStart, $db);
if (count($navigation) > 0) {
$arrNavigationElements = array();
foreach ($navigation as $key => $data) {
$arrNavigationElements[] = '<a href="'.$sess->url('front_content.php?idcat='.$data['idcat']).'" class="additionalnavi">'.$data['name'].'</a>';
}
echo implode (' | ', $arrNavigationElements);
}
?>
Klar ist, dass beim Input sowas wie "C.urlname" mit in die Query muss. Ebenso in den Bereichen "selected" und "category". Nur habe ich da keinen Schimmer, wie ich das mache.
In den Output muss dann sowas wie:
Code: Alles auswählen
$arrNavigationElements[] = '<a href="'.$sess->url('front_content.php?path='.$data['urlname']).'" class="additionalnavi">'.$data['name'].'</a>';
Aber richtig zusammen bekomme ich es nicht. Kann da wer helfen?
Danke!
Gruß
Stefan.