Page 1 of 2
Importing an Excel table
Posted: Fri Nov 17, 2006 4:27 pm
by thing
Hi all,
I wondered, is there an easy way to place or import an Excel table in to a CMSMS page?
That's it - really simple!
Otherwise my client will have to enter his data in to an HTML table by hand - doable, but tedious!
Thanks.
Re: Importing an Excel table
Posted: Fri Nov 17, 2006 6:25 pm
by cyberman
Please look at
this Smarty plugin.
Sorry, docs are only in german - so feel free to ask if there is a problem.
Re: Importing an Excel table
Posted: Fri Nov 17, 2006 8:11 pm
by thing
Nice one, thanks.
I'll have a play and see if I can make sense of it - I can read a little (well very little) German so I might be able to sort it otherwise I'll take you up on the offer of questioning you!
All the best.
Greg.
Re: Importing an Excel table
Posted: Sat Nov 18, 2006 6:32 pm
by Pierre M.
Another way (not as good as Cyberman's)) if you have not yet thought of it : OpenOffice Calc and Gnumeric can export Excel spreadsheets to HTML (not MShtml).
PM
Re: Importing an Excel table
Posted: Sat Nov 18, 2006 10:17 pm
by thing
Worth a go too if necessary.
I'm guessing, if I used this route, I paste the code either of those programs make in to the code view in page editing screen of CMSMS? That simple?
Thanks for the input - I need all the options possible so I can give the client the best alternatives to make his life easy!
Greg.
Re: Importing an Excel table
Posted: Sun Nov 19, 2006 7:41 pm
by Pierre M.
I don't know. Just try :
-pasting "full wysiwyg" (from a browser window to wysiwyg editor)
-pasting code (from view source to code input)
-inserting as global content bloc ?
And may be tidy-ing before can help.
Please report your successes, I'm sure other wil be interested.
PM
Re: Importing an Excel table
Posted: Mon Nov 20, 2006 10:55 am
by thing
Probably would have done that anyway - I'm a great one for experimenting first rather than asking for help!
Cheers - I'll certainly let folk know how it goes.
Greg
Re: Importing an Excel table
Posted: Mon Feb 05, 2007 8:39 pm
by Greg
Greg did you ever get this working ?
Re: Importing an Excel table
Posted: Mon Feb 05, 2007 9:41 pm
by thing

Nope.
In the end I set an HTML table up in Dreamweaver, pasted that in to this page
http://thelaymaster.com/cms/index.php?page=results and then left the client to play. He copies the code to every new results page he needs and just types in, on a daily basis, the results.
He's happy. Which is really all that matters.
I did try a lot of different routes to get an Excel table straight in with minimal fuss but nothing worked quite well enough - ultimately the route I went down, thought sort of clunky, gives a better end result.
Thanks for asking though!
Since doing this site, and a few others, in CMSMS I've had to make one in Joomla. I can safely say CMSMS is easier and, as an added bonus, the experience I've had using it helped massively in working out how the hell to do anything in Joomla!
Best wishes to all.
Re: Importing an Excel table
Posted: Tue Feb 06, 2007 4:14 pm
by Greg
I was able to import the csv and create a table based on the plugin Piratos provided above.
What I cannot figure out is how to use a 'table sort' now that I have the table created.
I would like to be able to sort the table - on the fly - when a column header is clicked on.
Javascripts are available that accomplish this but they don't work with CMSMadesimple.
Here is one example
Or if someone could make a plugin
from this php code
Anyone have an idea how I might accomplish this? Any help would be greatly appreciated.
Re: Importing an Excel table
Posted: Tue Feb 06, 2007 4:22 pm
by cyberman
Re: Importing an Excel table
Posted: Tue Feb 06, 2007 6:46 pm
by Greg
Cyberman I have read that but the tables are not created from a query of the database. I am creating the tables from a csv file with the csv function created by Piratos.
Importing an Excel table
Posted: Sun May 13, 2007 4:51 pm
by Greg
I got this working:
Attached function that will import a csv file into a html table
You can use the table sort javascript (attached) from
Stuart Langridge,
LINK
The information on use of the tag itself is in the help as well as the link to Stuart's page and the basics of how to set-up the sort javascipt, styles, etc.
Author is anonymous as I cannot remember where I obtained the basic code.
(remove .txt from attachments - place function.csv.php in plugins folder - place sorttable.js wherever you are placing other javascript)
[gelöscht durch Administrator]
Re: Importing an Excel table
Posted: Tue May 15, 2007 2:23 am
by moorezilla
This works great! Thanks!
I just have one more question/request. Is there any way to get one column from the csv file to be recognized by smarty as an email, so that smarty would hex encode it?
I tried changing the csv file to have {mailto address="
email@email.com" encode="hex"} for all the emails, but this isn't interpreted as smarty code using this csv to table tag. It just strips out the double quotes and prints the brackets to the screen even if they are all backslashed. Is there some way to force smarty to interpret, or is this functionality lost if the page data isn't kept in the database?
Basically, is there any way to add a step to this so that emails in a csv file can be caught and hex encoded by smarty? If there is, that would be splendiferous!
Many thanks,
am
edit... maybe there could be a column name reserved, so that if there is a column in the csv file called or containing "Email" that entire column position has
Code: Select all
{mailto address="contentsfromcsvcolumn" encode="hex"}
Although I guess this would not work with the javascript used to sort by column, unless there is some way to force smarty to recompile the source. I don't know. This is beyond my current abilities.
Re: Importing an Excel table
Posted: Fri Jun 01, 2007 12:36 am
by Greg
Here is an updated function.csv.php
I added email spam protection based on Thomas Gubisch's function.email.php code.
HTML output is now:
Code: Select all
<td><__script__ language="javascript" type="text/javascript"><!--
document.write('<a href="mailto:John.Doe'+'@'+'server.com">John.Doe'+'@'+'server.com</a>');
--></__script></td>
Thanks Thomas