[ic] Tables, csv, forms, and best practice

mail lists at gmnet.net
Mon Feb 19 17:30:40 EST 2007


I have a complex site with forms for users to input html and other data
taken from the fckeditor.  I would like some feedback on my technique
and suggestions for best practices for this type of solution.

Here is how I write data to tables:

After I get the data from the user in a text area or field, I filter it
like so:

[tmp content_field][cgi name=content_field
filter="restrict_html.a.b.i.u.blockquote.li.ol.ul.em.br.tt.p.strong.div.img.table.tr.td.center" keep=1 enable_html=1][/tmp]

    $Scratch->{content_field} =~ s/"/"/g;
    $Scratch->{content_field} =~ s/'/'/g;

Basically I convert all " to " and ' to ' before I save to the
database tables.  The reason I do this is to fix a problem when running
into them when I use the [perl] tag to write the table.  However, this
is not good if the data in the table is to be interpreted as html. i.e.
<a href="http://...." 

The following allows me to write to the table, and get the key code of
the new created record:

  [perl tables=tablename]
   my $db = $Db{tablename};
   my @wanted = qw/ 
    my %record;
    for(@wanted) {
      my $thing = $Values->{$_};
      my $keyname = $_;
      $record{$keyname} = $thing;
    $Scratch->{key} = $db->set_slice(undef, \%record);

One big problem I have is with new lines.  I am trying to put data from
the products/tablename.txt file into open office calc and all the new
lines that people put into their records are forcing OO to create new
rows in the wrong places.

Are there any "best practices" or other documentation for dealing with
complex data in a clean and strait forward way with IC?


More information about the interchange-users mailing list