|
Posted by Jon on 01/20/06 17:22
All,
I'm building a CMS, and have run into another problem that I'm not sure
which direction to take on it. Basically, I allow users to add pages, and
allow them to hide/unhide links (sub-navigation) on any page they wish. The
problem now is in the link order. I want them to be able to choose the link
order, and am not sure of the best way to handle this.
I have considered up and down arrows, however I'm not really sure of the
code I'll need to have them query the DB based on that (would I simply
subtract or add one to the linkOrder to the DB?). So, we have also discussed
the use of a drop-down list with a list of numbers showing the current order
(from the DB) that each link is in, along with numbers to change the order
by clicking a down arrow and submitting a form.
My question is mainly - which method would be best? What would the code, or
even the algorithm look like here? The select box code is looking ugly as
hell because I want to echo all of this while I'm echoing the actual links,
and the up/down arrow choices seems confusing as far as the algorithm to me.
Here's the code block I'm using to echo values from the DB as links on the
CMS:
<?php
//start a table
echo "<table width=\"150\"><tr><td></td></tr>";
//call the getLinks function (from a displayClass I have built)
$links = $displayData->getLinks($pageID, $contentID, $data);
//start looping through the records
while($rows=mysql_fetch_array($links)){
//echo links in table cells along with a hide link to have a link
NOT show up on the actual site
echo "<tr><td><a
href=index.php?pageID=".$pageID."&contentID=".$rows['cContentID'].">".$rows['cLinkDisplay']."</a></td><td><a
href=\"index.php?hideLink=".$rows['cContentID']."&contentID=$contentID&pageID=$pageID\">Hide</a></td></tr>";
}
echo "</table>";
?>
Thanks for any help
Navigation:
[Reply to this message]
|