Del denne kode op, hvordan?
Hejsa alle....Hvordan deler jeg denne kode op, så det bliver 2 adskilte funktioner... En der kalder pages der er "NULL" (siderne) og en der kalder undersiderne - altså hvor parent_page er = et eller andet id....
<?
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";
}
else {
$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;
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)) {
?>
<tr>
<td width="5"></td>
<td width="400">
-
<?
if ($i == 0) {
?>
<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>
<?
}
if ($i == ($last - 1)) {
?>
<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 href="webmodule/edit-page.php?doc_id=<?=$side['doc_id']?>">
<?=$side['title']?> - <? $tempDato = split("-",$side['created']);
$tempDato = array_reverse($tempDato);
echo join("-",$tempDato); ?>
</a> - <a target="_blank" href="/index.php?pageid=<?=$side['doc_id'];?>"><img src="/admin/images/seside.gif" alt="Klik for at se siden"></a>
<?
RtrnSubPages($side['doc_id']);
?>
</td>
</tr>
<?
$i++;
}
?>
</table>
<?
} // End function RtrnPages
?>
------------------------------------------------
Det skal stadig fungere så man kan se hvilke undersider der hører til hvilken "hovedside"