Join the Facebook Fan Page.

Main Menu

Table From CSV

Started by Anguz, October 27, 2004, 06:34:53 AM

Previous topic - Next topic


Link to Mod

This mod adds a new tag that'll create a table from CSV text. This is, by far, the simplest way of creating table. Each line is a row (if there's more than one, the first will be the headers). Values are separated by the separator specified in the tag using this format [table=,] (no value [table=] will default to ","). The resulting table can be sorted by clicking on the column headers.

Copyright 2007 by Cristian Lavaque.
sorttable.js copyright 2003 by Stuart Langridge.
Cristián Lávaque


Here's a simple example:


Attachment 1 is how it it comes out and 2 after sorting it by Name clicking on the column header. ;)

Of course, you can style it in your CSS file, the class is .sortable.
Cristián Lávaque

Tristan Perry

Nice job  :) It looks really helpful!


Yea, I think it's a very cool idea actually.
I'm only a half geek really...

Omar Bazavilvazo

I like it a lot: simple and useful!

Personal Signature:

NO me manden PM para soporte o dudas
...Leo los foros como todos...


Very nice mod! A simple mod that can be very handy! I really like it.  :)
Dev Consultant
Former SMF Doc Coordinator


Will probably install this one :). Nice idea.
Liverpool FC Forum with 14 million+ posts.


Hey all, thank you for the comments! I'm really glad you find it useful. :D

I'll probably add alternating backgrounds (optional of course, modifying the styles) tonight. Will also move it in parsecode and place it before the br tag, so you can use the latter in the values, that'll let you have multiple lines in a cell if so desired.

A clarification on the separators use. Anything between the = and ] will be used as the separator, that includes tabs (just tested to make sure), which is good for tab separated CSV files. You'll need to copy/paste the tab from a text editor though, cause hitting tab in the post form will move the focus to the next element in the form. If it's left blank, it'll default to a comma.

One more thing, it's a nice short-hand to create tables in messages and it's way faster than the current table parsing, even the one in FasterParsecode, so you may prefer to use it when possible.
Cristián Lávaque


Updated to 1.10

Didn't do the br tag thing because it gave some trouble and I didn't consider it that important to bother making it work. If you need multiple lines in a cell, just use the normal table tag. :)

The alternating row backgrounds are in there now. Thanks to [Unknown] for his help with JS. I'm attaching a new screenshot. ;)

I also added some simple styling, as you can see, which you can easily modify if you don't like.
Cristián Lávaque


Hello Anguz,

Thank you for this simple en useful mod.



I'm glad you liked it! Thank you for writting! :D
Cristián Lávaque


Michael Eshom
Christian Metal Fans


I am having a problem with this mod. When I add a link to a row, first the link won't auto wrap a [ url ] tag around it like the links do on this forum when just typing in a link. For example typing in without the [ url ] tags will still make it clickable. And also when I do wrap the [ url ] [ /url ] tags around it the link will turn out all wrong.

So for example if I do this,


the page that shows up when clicking that link is:

of course where myaddress and myforumdirectory were used instead of my real one.

any ideas how to fix it so you can use links in the tables?

PS: If it helps, when hovering the link at the bottom the link appears to be going to:\"\"
Dev Consultant
Former SMF Doc Coordinator


I haven't tried using tags in the CSV table. I'll try it out in my test server and see what I can find out.
Cristián Lávaque


I fixed it parsing the CVS table before the other tags. Links are working now, look at the status bar in the screenshot. I'll post an update in a moment.
Cristián Lávaque


Okay thanks. Great mod may I say again. It is a very nice simple way to arrange things in order. Keep up with the nice bbcodes.  ;D
Dev Consultant
Former SMF Doc Coordinator


Updated to 1.11

  • Links, and probably other bbcode tags, weren't working inside the table.
  • You can now also use the br tag which will let you do multilines inside a value.
Cristián Lávaque

Elijah Bliss

Do I have to add anything in order to make the tables sortable because their are no links showing up to sort them as shown in your screen capture.

Aside from that, great mod.


There's a javascript file added to your default theme dir during install. If you're using another theme, you need to make a copy of the file to that theme's dir as well.
Cristián Lávaque

Elijah Bliss

Quote from: Anguz on December 05, 2004, 06:20:46 PM
There's a javascript file added to your default theme dir during install. If you're using another theme, you need to make a copy of the file to that theme's dir as well.

The "sorttable.js" is located in the theme I am using.

The problem I am encountering is this:
if I just have this for example:
[table=]Giants,Forty Niners,Bears[/table]

the sortable links show up in the headers, but as soon as I make a carriage return,
[table=]Giants,Forty Niners,Bears

the links in the headers go dead.