Advancedform_XH : want only 1 set in saved file

Third Party Plugins to CMSimple - how to install, use and create plugins

Moderator: Tata

Advancedform_XH : want only 1 set in saved file

Postby designfjord » Sat Jun 30, 2012 11:40 am

Hello,
in a special Advancedform_XH-form, only one set of data should be stored in a file for displaying it later.
I thought it's easy to avoid reading of the data in the stored file by changing the advfrm.php.
Simply commenting at the end of function advfrm_read_csv($id):
Code: Select all
    $data = array();
/*
    foreach ($lines as $line) {
   $line = array_map('trim', explode("\t", $line));
   $rec = array_combine($fields, $line);
   $data[] = $rec;
    }
*/
// ### special : only one set!
    return $data;


But this didn't work :?:

Any hint welcome and
Thanks in advance

Jochen
XH 1.4, XH 1.5, RealBlog1.5 | OS: XP Win7 Ubuntu | keep it simple
designfjord
 
Posts: 45
Joined: Fri Apr 16, 2010 4:19 pm
Location: Germany/Franconia

Re: Advancedform_XH : want only 1 set in saved file

Postby cmb » Sat Jun 30, 2012 12:33 pm

Hi Jochen,

advfrm_read_csv() is not called, when a new record is stored. This is done by calling advfrm_append_csv(). So you probably can simply change this function to writing instead of appending the record: advfrm.php line 360:
Code: Select all
   if (($fh = fopen($fn, 'w')) === FALSE

I haven't tested this, though, but it might work.

Christoph
Christoph M. Becker---Plugins for CMSimple_XH
cmb
 
Posts: 5468
Joined: Tue Jun 21, 2011 11:04 am
Location: Germany

Re: Advancedform_XH : want only 1 set in saved file

Postby designfjord » Sat Jun 30, 2012 2:54 pm

works fine! (as ever!)
Thank you
XH 1.4, XH 1.5, RealBlog1.5 | OS: XP Win7 Ubuntu | keep it simple
designfjord
 
Posts: 45
Joined: Fri Apr 16, 2010 4:19 pm
Location: Germany/Franconia


Return to Addons and Plugins

Who is online

Users browsing this forum: No registered users and 2 guests