News:

Wondering if this will always be free?  See why free is better.

Main Menu

Table From CSV

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

Previous topic - Next topic

ianus

#100
Long Hello!
A year ago, I decided to bring up my own board with some information about RPG and movie stuff. I decided to use the SMF because I noticed the Table From CSV –mod.
There is not much conted at the moment, but some tables are available.

So I like to send a honest ,,Tanks you". I greatly appreciated your work.

I like to give a single link, especially for SMF users who like to see this mod working.
It´s an german speaking site, but this should not circumvent the impression.

You will notice, even the spoiler mod is working, even inside of the table.

The link is
http://www.firopolis.de/forum/index.php/topic,5.0.html
or
http://www.firopolis.de/forum/index.php/topic,219.msg292.html#msg292
or ...

Thanks again and best regards.

Anguz

ianus, thank you very much for your message! This kind of feedback always makes me very happy. :D
Cristián Lávaque http://cristianlavaque.com

takeliner

Let me thank you first for this mod! It's great, but
I'm experiencing a little error in my Table:

If I have a url in my Table like this
[url=http://www.google.de/imghp?hl=de&tab=wi&q=]Link]/url]
and send it. There will be this link generated:
http://www.google.de/imghp?hl=de&%3C/td%3E%3Ctd%20valign=%22top%22%3Etab=wi&%3C/td%3E%3Ctd%20valign=%22top%22%3Eq=

If I wrote this [url=http://www.google.de/imghp?hl=de&tab=wi&q=]Link]/url] outside of the table it works great, but not in the CSV Table.

I hope anyone can help me fixing this little glitch.

PS: Sorry for my bad english, i'm only a lazy german ;-)

CyA Takeliner

Anguz

Hmm... that sounds like a problem that the mod had in an earlier version. Did you install the latest one? BTW, a bracket for the closing URL tag is wrong, is it like that in your test?
Cristián Lávaque http://cristianlavaque.com

agridoc

#104
There is a small error in brackets (Link]/url). The right code is
[url=http://www.google.de/imghp?hl=de&tab=wi&q=]Link[/url]

I tried it in my forum (SMF 1.03) and works OK in a CSV table.
  For Greek aeromodellers and our friends around the world  - Greek Button sets for SMF - Greeklish to Greek mod
Δeν αφιερώνω χρόνο για μηνύματα σε greeklish.

Anguz

Cristián Lávaque http://cristianlavaque.com

takeliner

Oh-Oh

At first I had an error in my post with the bracket, in testing there is one. But I guess i found the problem, we're using the 1.0.5 version of smf...

I forgot, that the co-admin told me he updatet a few days ago,(my organization is very messy and stressed up at the moment).

I'm sorry I forgot about the version. So I guess that Problem is cause of the yet uncompatible version of my SMF.(Ohoh, hard with my school english  :'( )

So i've to wait I guess.... although it works, only without an url Tag in a table...(It makes the table much less wide, so there's no horizontal scrolling *G*)

CyA Takeliner

agridoc

takeliner there are Table From CSV versions up to SMF 1.05 http://mods.simplemachines.org/index.php?mod=40

I have a SMF 1.05 test forum with Table From CSV Mod and your link, as well as others, work perfectly in a table. You must update the FasterParsecode Mod, then theTable From CSV Mod with the versions for SMF 1.05.

There is no version for 1.1 yet, I hope Anguz will make one  when the right time  comes ;)
  For Greek aeromodellers and our friends around the world  - Greek Button sets for SMF - Greeklish to Greek mod
Δeν αφιερώνω χρόνο για μηνύματα σε greeklish.

takeliner

Oops, then I have the latest Versions:

SMF: 1.05
Parsecode: 1.09
TableCSV: 1.23

No other Mods installed, everything works except the Url Tag in the table.

I tried a bit and have these state of progress:

There seems to be a mistake/error with the Url that has special Chars in it:

If I put this:
[table=;]A;B;
[url=http://www.google.de/imghp?hl=de&tab=wi&q=]Link[/url];[url=http://www.google.de]Link[/url]
[/table]


The First Url under the A(the one with ...imghp?... )
makes this link:
The "B" Url (the normal hxxp:google.de [nonactive]) makes this link:
http://www.google.de/

Because it works by other users, maybe it's only a mistake in the code?

Thanks for your help!
CyA Takeliner

Anguz

The problem seems to be given by the amp symbol. I'll look into it.
Cristián Lávaque http://cristianlavaque.com

Anguz

I haven't tested it yet, can't right now, but I believe the problem comes from the & being converted to & somewhere, and since you're using ; as the separator, you get extra td tags. Try using a different separator, please, and let me know how it goes. I'll try to fix the problem, though.
Cristián Lávaque http://cristianlavaque.com

Anguz

Quote from: agridoc on January 20, 2006, 08:17:57 AM
There is no version for 1.1 yet, I hope Anguz will make one  when the right time  comes ;)

Yeah, you'll get it soon :). Looking at the mod's code again today, I saw a couple of places it could be improved a bit. Not radically, though, it's already too good ;D.
Cristián Lávaque http://cristianlavaque.com

takeliner

Excellent it works!

I'm using the  ~ as the seperator now. 'Cause i found no chance in Excel to say it which seperator he should use as a seperator. I wrote a small php code in which I format the exported *.CSV automatically with Boardcode and now with the replace of the seperator.

Thanks alot!

CyA Takeliner

Anguz

Cristián Lávaque http://cristianlavaque.com

agridoc

Yes I get an error too in links mith semicolon ";" as separator. I did my tests with comma "," although I usually use a  "|".

A table also can be copied and pasted to Word, then use it' s options to select a separator from table to text screen.
  For Greek aeromodellers and our friends around the world  - Greek Button sets for SMF - Greeklish to Greek mod
Δeν αφιερώνω χρόνο για μηνύματα σε greeklish.

takeliner

Word..., I should have thought about it.
But with my .php its possible to write predefined text just before and directly after a column automatically,
(e.g. the second column contains URLS, so I write only the http..link in the table and afterwards
I put it on the server, open the edit.php once and get a done.csv with the replaced seperators and the code wrapped around the Columns.
If anybody is Interested in the phpcode I will give ya the code....

CyA Takeliner

Anguz

Oh, I'm sure there'll be many who'd be happy to have it. If you're so kind, please post it here between code tags, unless you prefer people contacting you via PM and giving it privately. Thanks!
Cristián Lávaque http://cristianlavaque.com

takeliner

Yeah, I've already got PMs. But I was the weekend away from everything that's like a computer! *G*

Here comes the PHP-Code, it does:
-Wrapping Code around each column
-Deleting the enclosure "
-Replacing the ; to an ~ not to get the error I had a few posts ago(the ; with an ? can make problemes)
so to have an ~ as an seperator

<?php
error_reporting
(E_ALL); 
//Configuration
//input.csv
$inputdata 'input.csv';
$editeddata 'done.csv';
$seperator ';';
$newseperator '~';
$enclosure '"';
$newenclosure '';
//Wrapping the Code around the columns
//X-ColumnNumber-a <--Code at BEGINNUNG of a column
//X-ColumnNumber-e <--Code at END of a column
//Currently supports 8 Columns, but easily to make up to infinite *G*
$X1a '[color=green]';
$X1e '[/color]';
$X2a '';
$X2e '';
$X3a '[color=orange]';
$X3e '[/color]';
$X4a '[color=red]';
$X4e '[/color]';
$X5a '[color=blue]';
$X5e '[/color]';
$X6a '[url=';
$X6e ']Link[/url]';
$X7a '';
$X7e '';
$X8a '[color=red]';
$X8e '[/color]';
//Reading input.csv
$fh fopen($inputdata'r');
//Wraps Code around the Columns
while (($line fgetcsv($fh1000';')) !== FALSE ) {
    
$line[0] = $X1a.$line[0].$X1e;
$line[1] = $X2a.$line[1].$X2e;
$line[2] = $X3a.$line[2].$X3e;
    
$line[3] = $X4a.$line[3].$X4e;
$line[4] = $X5a.$line[4].$X5e;
$line[5] = $X6a.$line[5].$X6e;
$line[6] = $X7a.$line[6].$X7e;
$line[7] = $X8a.$line[7].$X8e;
$file[] = $line;
}
fclose($fh);
$fh fopen($editeddata'w');
foreach (
$file as $line) {
    
fputcsv($fh$line';') or die('Fehler beim schreiben der fertig.csv(Chmod?)!');
}
fclose($fh);
//Deleting Enclosure
$fh fopen($editeddata'r');
$gelesen fread($fh,10000000);
fclose($fh);
$ersetzt str_replace($enclosure,$newenclosure,$gelesen);
$fh fopen($editeddata'w');
fwrite($fh$ersetzt);
fclose($fh);
echo(
'Fertig!!!');
//Deleting Seperator
$fh fopen($editeddata'r');
$gelesen fread($fh,10000000);
fclose($fh);
$ersetzt str_replace($seperator,$newseperator,$gelesen);
$fh fopen($editeddata'w');
fwrite($fh$ersetzt);
fclose($fh);
echo(
'Fertig!!!');
?>


CyA Takeliner

Prasad007


Anguz

takeliner, thx for the code. I'd suggest using a separator that's very unlikely to happen in the table content, like |, cause ~ happens in many URLs.

Prasad007, glad you like it. :)
Cristián Lávaque http://cristianlavaque.com

Advertisement: