Importing an Excel table

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
thing

Importing an Excel table

Post 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.
cyberman

Re: Importing an Excel table

Post by cyberman »

Please look at this Smarty plugin.

Sorry, docs are only in german - so feel free to ask if there is a problem.
thing

Re: Importing an Excel table

Post 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.
Pierre M.

Re: Importing an Excel table

Post 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
thing

Re: Importing an Excel table

Post 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.
Pierre M.

Re: Importing an Excel table

Post 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
thing

Re: Importing an Excel table

Post 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
Greg
Power Poster
Power Poster
Posts: 598
Joined: Sun Sep 26, 2004 6:15 pm
Location: Saskatchewan - Canada

Re: Importing an Excel table

Post by Greg »

Greg did you ever get this working ?
Greg
thing

Re: Importing an Excel table

Post by thing »

:D 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.
Greg
Power Poster
Power Poster
Posts: 598
Joined: Sun Sep 26, 2004 6:15 pm
Location: Saskatchewan - Canada

Re: Importing an Excel table

Post 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.
Greg
cyberman

Re: Importing an Excel table

Post by cyberman »

Greg
Power Poster
Power Poster
Posts: 598
Joined: Sun Sep 26, 2004 6:15 pm
Location: Saskatchewan - Canada

Re: Importing an Excel table

Post 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.
Greg
Greg
Power Poster
Power Poster
Posts: 598
Joined: Sun Sep 26, 2004 6:15 pm
Location: Saskatchewan - Canada

Importing an Excel table

Post 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]
Last edited by Greg on Sun May 13, 2007 6:47 pm, edited 1 time in total.
Greg
moorezilla

Re: Importing an Excel table

Post 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.
Last edited by moorezilla on Tue May 15, 2007 12:46 pm, edited 1 time in total.
Greg
Power Poster
Power Poster
Posts: 598
Joined: Sun Sep 26, 2004 6:15 pm
Location: Saskatchewan - Canada

Re: Importing an Excel table

Post 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
Attachments

[The extension txt has been deactivated and can no longer be displayed.]

Greg
Locked

Return to “CMSMS Core”