 |
 |
Reverse HTML Table Row Order?
|
 |
|
 |
|
Professional Poster
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status:
Offline
|
|
Hi
Is there a program (for OS X), a GUI HTML editor that can reverse the row order of a table? I have a very long static (not from database) table that I put in chronological order. Upon great reflection, I see that reverse chronological order is more... logical. I'm trying to avoid manually doing the reversing by copying row after row and pasting it on the other side of the document. GoLive can do basic sorting but now a row reversal. Dreamwaver can't either from what I can see. Anyone know of anything else?
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Online
|
|
If it were me I would move away from relying on hard coded HTML to generate this table as soon as I could.
Why not dump the table contents into an array? This way, you can iterate through the array in whatever order you want. You could also fairly easily concoct a script that would parse your table and output the contents of the cells into an array.
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2004
Location: Copenhagen
Status:
Offline
|
|
I’d have to agree with Besson here. Unless there’s some very specific reason why you don’t want this to be culled from a database, it would make much more sense to have the table data in a database and draw it from there.
You can always just copy-paste the table itself (from the HTML page, not the source) into an Excel spreadsheet, and then export it as a CSV (comma-separated values) file. Most databases allow you to insert data from CSV files, so you can get all your data neatly databasised that way rather easily.
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Online
|
|
It doesn't even have to be a database if you don't want to put together that backend, which is why I suggested an array. A database would give you a lot of added benefit though...
In general static content is always a PITA.
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: May 2001
Status:
Offline
|
|
You are SOL.
Put your data in a CSV file or database.
|
|
Republican Party: Family Values Party
Champions of Family Values:
John Ensign, Mark Sanford, David Vitter, Mark Foley, Larry Craig
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status:
Offline
|
|
The reason its hard coded html is because it's historical data that will never ever change. Except for right now because I realize it makes more sense to have newer stuff at the top. But it would be pointless to put this data in an array or a database.
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2004
Location: Copenhagen
Status:
Offline
|
|
Even if the data won’t change, you might still (at some point) want to change the layout of the page or something, no? Having one line of code to change and then iterating through an array or a database call would make that much easier, too.
I can’t really see any other way of reversing the table sorting order without resorting to some kind of scripting or a CSV file, anyway, so why not just make it an array as well—just in case?
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Online
|
|
Originally Posted by l008com
The reason its hard coded html is because it's historical data that will never ever change. Except for right now because I realize it makes more sense to have newer stuff at the top. But it would be pointless to put this data in an array or a database.
I disagree. For one it's a good learning experience for you if you haven't done something like this before, this is a reoccurring problem. Secondly, depending on how long your table is it would probably take you less time to do it as described.
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status:
Offline
|
|
I have years of experience working with data pulled from mysql databases. Believe me I don't need any more. This is very much a one time change.
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Online
|
|
How about you meet in the middle then?
You could write your script to generate the HTML that would be needed to generate the reverse sorted table, and then just paste in that resulting HTML into your static page.
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Online
|
|
In case my original plan wasn't clear, if I were doing this in PHP I would use preg_match to match each cell using the cell tags as delimiters. This way, I wouldn't have to manually input anything into MySQL or a manually defined array.
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status:
Offline
|
|
In case I wasn't clear myself, what i was lookign for was a shortcut that would require no coding at all. Lots of GUI editors have options for automatically sorting items in an HTML table. I haven't seen any for reversing the order, only sorting by a column. But if I could just open my doc in a program, flip it, and be done with it forever, I'd be happy.
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: May 2001
Status:
Offline
|
|
Get an HTML to excel exporter.
Sort it in Excel.
Then use Excel's HTML exporter.
Or open up your text editor and write some code using regular expressions to export your data to CSV or excel.
Or use a WYSIWYG HTML editor and copy all your data to Excel.
|
|
Republican Party: Family Values Party
Champions of Family Values:
John Ensign, Mark Sanford, David Vitter, Mark Foley, Larry Craig
|
| |
|
|
|
 |
|
 |
|
Moderator 
Join Date: Jun 2000
Location: Inside 128
Status:
Online
|
|
^That's what I was going to suggest.
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2004
Location: Copenhagen
Status:
Offline
|
|
Originally Posted by hyteckit
Then use Excel's HTML exporter.
Oh, I didn’t know Excel had an HTML exporter. That makes it easier, of course.
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Online
|
|
Of course, if it is anything like Word's exporter you'd be better off having a bunch of monkeys code your HTML for you.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|