3 niveau af menu?
Hey alle, har nedenstående funktioner der udskriver "hovedsider" og der pågældende undersider til dem hvis der er nogle...Mit problem er at at jeg kun får 1 indryk selvom vi er ude i nivueau 3 på menuen - Dvs, når jeg er ude i menu 3, skal der komme endnu et indryk, lige nu laver den bare 1 <li> ved undersider, også selvom det er niveau 3.... Need some help here :)
<?
function RtrnLabelTxt($Label_ID) {
$SQL = "SELECT label_txt FROM label_txt WHERE label_id = '$Label_ID'";
$mq = mysql_query($SQL) or die(mysql_error());
while($myrow = mysql_fetch_assoc($mq)) {
$tael = mysql_num_rows($mq);
if($tael != "0") {
echo $myrow['label_txt'];
} else {
echo " ";
}
}
// mysql_close($mq);
} // End function RtrnLabelTxt
?>
<?
Function RtrnLoginForm($style) {
if($style == "1"){
$frm = '<form action="includes/auth-user.php" method="post">';
$frm .= '<table width="300" cellpadding="0" cellspacing="5" border="0" class="logintable">';
$frm .= '<tr>';
$frm .= '<td>';
$frm .= 'Brugernavn:';
$frm .= '</td>';
$frm .= '<td>';
$frm .= '<input type="text" name="username" class="frm_input" />';
$frm .= '</td>';
$frm .= '</tr>';
$frm .= '<tr>';
$frm .= '<td>';
$frm .= 'Password:';
$frm .= '</td>';
$frm .= '<td>';
$frm .= '<input type="password" name="password" class="frm_input" />';
$frm .= '</td>';
$frm .= '</tr>';
$frm .= '<tr>';
$frm .= '<td></td>';
$frm .= '<td>';
$frm .= '<input type="submit" value="Login" class="frm_but" />';
$frm .= '</td>';
$frm .= '</tr>';
$frm .= '</table>';
$frm .= '</form>';
}
echo $frm;
} // End function RtrnLoginForm
?>
<?
function RtrnPages($topPage) {
?>
<table width="600" border="0" cellpadding="5" cellspacing="0">
<?
if ($topPage == "NULL") {
$SQL = "SELECT * FROM pages WHERE parent_page IS NULL ORDER BY sort, doc_id";
$cSQL = "SELECT count(*) FROM pages WHERE parent_page IS NULL";
}
$mq_count = mysql_query($cSQL) or die(mysql_error());
$r_count = mysql_fetch_array($mq_count);
$last = $r_count[0];
$mq_undersider = mysql_query($SQL) or die(mysql_error());
$i = 0;
echo '<tr>';
echo '<td class="txtbold">Titel</td>';
echo '<td class="txtbold">Oprettet</td>';
echo '<td class="txtbold">Sorter</td>';
echo '<td class="txtbold">Status</td>';
echo '<td class="txtbold"></td>';
echo '</tr>';
while ($side = mysql_fetch_assoc($mq_undersider)) {
$status = $side['active'];
?>
<tr>
<td>
<a href="webmodule/edit-page.php?doc_id=<?=$side['doc_id']?>">
<?=$side['title']?>
</a>
</td>
<td>
<?
$tempDato = split("-",$side['created']);
$tempDato = array_reverse($tempDato);
echo join("-",$tempDato); ?>
</td>
<td>
<?
if ($i == 0) {
//Udskriv ingen pil
?>
<img width="10" height="10" src="images/blank.gif">
<?
} else {
?>
<a href='/admin/webmodule/webarchive.php?mode=reprio&rparent=<?=$topPage?>&ridartikel=<?=$side['doc_id']?>&dir=up'><img width="10" height="10" src="images/pilop.gif" border=0></a>
<?
} // End else
if ($i == ($last - 1)) {
//Hvis det er den sidste side, så udskriv ingen pil
?>
<img width="10" height="10" src="images/blank.gif">
<?
} else {
?>
<a href='/admin/webmodule/webarchive.php?mode=reprio&rparent=<?=$topPage?>&ridartikel=<?=$side['doc_id']?>&dir=down'><img width="10" height="10" src="images/pilned.gif" border=0></a>
<?
}
?>
</a>
</td>
<td>
<?
if($status == "1"){
echo '<span style="color: green;">Online</span>';
} else {
echo '<span style="color: red;">Offline</span>';
}
?>
</td>
<td>
<a target="_blank" href="/index.php?pageid=<?=$side['doc_id'];?>"><img src="/admin/images/seside.gif" alt="Klik for at se siden"></a>
</td>
<tr>
<?
RtrnSubPages($side['doc_id']);
?>
</tr>
<?
$i++;
}
?>
</table>
<?
} // End function RtrnPages
?>
<?
function RtrnSubPages($topPage) {
?>
<div class="subPages">
<?
$SQL = "SELECT * FROM pages WHERE parent_page = $topPage ORDER BY sort, doc_id";
$cSQL = "SELECT count(*) FROM pages WHERE parent_page = $topPage";
$mq_count = mysql_query($cSQL) or die(mysql_error());
$r_count = mysql_fetch_array($mq_count);
$last = $r_count[0];
$mq_undersider = mysql_query($SQL) or die(mysql_error());
$i = 0;
while ($side = mysql_fetch_assoc($mq_undersider)) {
$status = $side['active'];
?>
<tr>
<td>
<li><a href="webmodule/edit-page.php?doc_id=<?=$side['doc_id']?>">
<?=$side['title']?>
</a></li>
</td>
<td>
<?
$tempDato = split("-",$side['created']);
$tempDato = array_reverse($tempDato);
echo join("-",$tempDato); ?>
</td>
<td>
<?
if ($i == 0) {
//Udskriv ingen pil
?>
<img width="10" height="10" src="images/blank.gif">
<?
} else {
?>
<a href='/admin/webmodule/webarchive.php?mode=reprio&rparent=<?=$topPage?>&ridartikel=<?=$side['doc_id']?>&dir=up'><img width="10" height="10" src="images/pilop.gif" border=0></a>
<?
} // End else
if ($i == ($last - 1)) {
//Hvis det er den sidste side, så udskriv ingen pil
?>
<img width="10" height="10" src="images/blank.gif">
<?
} else {
?>
<a href='/admin/webmodule/webarchive.php?mode=reprio&rparent=<?=$topPage?>&ridartikel=<?=$side['doc_id']?>&dir=down'><img width="10" height="10" src="images/pilned.gif" border=0></a>
<?
}
?>
</a>
</td>
<td>
<?
if($status == "1"){
echo '<span style="color: green;">Online</span>';
} else {
echo '<span style="color: red;">Offline</span>';
}
?>
</td>
<td>
<a target="_blank" href="/index.php?pageid=<?=$side['doc_id'];?>"><img src="/admin/images/seside.gif" alt="Klik for at se siden"></a>
</td>
<tr>
<?
RtrnSubPages($side['doc_id']);
?>
</tr>
<?
$i++;
}
?>
</div>
<?
} // End function RtrnPages
?>
<?
function selectSubPages($topPage, $niveau) {
if ($topPage == "NULL") {
$SQL = "SELECT * FROM pages WHERE parent_page IS NULL ORDER BY sort, doc_id";
} else {
$SQL = "SELECT * FROM pages WHERE parent_page = $topPage ORDER BY sort, doc_id";
}
$mq_undersider = mysql_query($SQL) or die(mysql_error());
while ($side = mysql_fetch_assoc($mq_undersider)) {
?>
<option name="doc_id" value="<?=$side['doc_id'];?>">
<?
for ($i = 0; $i<$niveau; $i++) echo "-";
?>
<?=$side['title']?>
</option>
<?
selectSubPages($side['doc_id'],$niveau + 1);
}
} // End function selectSubPages
?>
<?
function RtrnPageDate() {
$dag = date("d");
$month = date("m");
$year = date("Y");
?>
<input type="text" size="1" maxlength="2" name="datoDag" value="<?=$dag?>" />
-
<input type="text" size="1" maxlength="2" name="datoMaaned" value="<?=$month?>" />
-
<input type="text" size="3" maxlength="4" name="datoAar" value="<?=$year?>" />
<?
} // End Function RtrnPageDate
?>
<?
function resize( $filename, $newfilename, $maxw, $maxh )
{
$srcim = imagecreatefromjpeg( $filename );
$ow = imagesx( $srcim );
$oh = imagesy( $srcim );
$wscale = $maxw / $ow;
$hscale = $maxh / $oh;
$scale = ( $hscale < $wscale ? $hscale : $wscale );
$nw = round( $ow * $scale, 0 );
$nh = round( $oh * $scale, 0 );
$dstim = imagecreatetruecolor( $nw, $nh );
imagecopyresampled( $dstim, $srcim, 0, 0, 0, 0, $nw, $nh, $ow, $oh );
imagejpeg( $dstim, $newfilename, 85 );
imagedestroy( $dstim );
imagedestroy( $srcim );
}
?>
<?
function RtrnPageFiles($Doc_ID) {
$SQL = "SELECT * FROM files WHERE doc_id = '$Doc_ID'";
$mq = mysql_query($SQL) or die(mysql_error());
if (mysql_num_rows($mq) > 0) {
echo '<ul>';
while ($fil = mysql_fetch_assoc($mq_gf)) {
echo '<li>';
echo $fil['desc'];
echo $fil['filename'];
echo '<a href="edit-file.php?doc_id='.$Doc_ID.'&slet=slet&idfiler='.$fil['idfiler'].'">';
echo '<img src="images/delete.gif" alt="Slet" title="Slet" border="0"></a>';
echo '</li>';
} // End while
} else {
echo '<p<>Der er ikke tilfjet nogle filer til denne side</p>';
} // End if
} // End function RtrnPageFiles
function RtrnShowUsers(){
$SQL = "SELECT * FROM users";
$mq = mysql_query($SQL) or die(mysql_erro());
$tael = mysql_num_rows($mq);
echo '<table border="0" cellspacing="3" cellpadding="0">';
if($tael > "0") {
while($hent = mysql_fetch_assoc($mq)){
echo '<tr>';
echo '<td width="100">' . $hent['brugernavn'] . '</td>';
echo '<td><a href="/admin/usermodule/edit-user.php?userid='.$hent['userid'].'"><img src="/admin/images/edituser.gif" alt="Rediger bruger" /></a></td>';
echo '<td><a href="/admin/usermodule/delete-user.php?userid='.$hent['userid'].'"><img src="/admin/images/delete.gif" alt="Slet bruger" /></a></td>';
echo '</tr>';
}
}
echo '</table>';
}
?>