Jump to content

Display ordered list in descending order


Deepa

Recommended Posts

Hi..I understnad that Code:<ol><li> Car</li><li>Bus</li><li>Train</li></ol>will display 1.Car2.Bus3.TrainI want the lists to appear decending order as in3.Car2.Bus1.TrainThe logic is "Train"-- was added first, and the most recent addition-- "Car" is shown at the topNow these lists are added dynamicaly .. so i cannot use the <li value=#></li> manually for all the list itemsAny help is great helpThank youDeepa

Link to comment
Share on other sites

Even if they are pulled from an array, you need to sort the array some how and massage the sort order and the count of elements in the array. It doesn't need to be a DB thing.The first item would be value = $count, the next is value = $count minus 1, etc. And most likely, use an un-ordered list and include the value a an echo'd part of the <li>. (or <tr><td>)

Link to comment
Share on other sites

Actullay I am tryoing to use this in my blog tempalteBy default.. the blog posts are not numbered,,, i was able to locate and add numbers to the posts..Since the posts are displayed in Latest post first.... i want the numbers to appear in decending order..

Link to comment
Share on other sites

hmm.. i think so too..How much i wish the <ol> tag had something lilke<ol order='ASC or DSC'> for ascending and descending order.. Would maek lot of things easierThanks anyway..

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...