Ok, I got this order system running, where you fill in a form, attach files etc. To that I've chosen to write all the orders to a flat file to keep some kind of a log.
Now though, we are trying to implement this fb system with our business system (importing csv/txt files). I'm however have trouble giving the files a variable name (i.e. based on date, id or whatever). In a perfect world you should have been able to just put {$orderid}.txt as the "Destination file" name. But now you can't.
So... is there any way to get around that? Prefarably with the Flat-file option.
- Save Flat-file as to 123456.txt for example {$orderid}.txt
- Or something similar..
How do the system store and fetch the filename information? Maybe I can sort it out manually in a simple.. even though Im limited in server sided coding skills
FormBuilder: Flat file name by variable
-
- Forum Members
- Posts: 50
- Joined: Fri Jan 16, 2009 1:07 pm
-
- Forum Members
- Posts: 50
- Joined: Fri Jan 16, 2009 1:07 pm
Re: FormBuilder: Flat file name by variable
Anyone?
Ah well, I tried hardcode mod it in DispositionFile.class.php .. but since Im a terrible PHP coder I cant quite get it to work. Or am I just messing with the wrong variables?
(at around line 70):
to something like this:
or even..
Am I on the right path here? Please help me
Ah well, I tried hardcode mod it in DispositionFile.class.php .. but since Im a terrible PHP coder I cant quite get it to work. Or am I just messing with the wrong variables?
(at around line 70):
Code: Select all
$filespec = $this->GetOption('fileroot',$options['uploads_root']).'/'.
preg_replace("/[^\w\d\.]|\.\./", "_", $this->GetOption('filespec','form_submissions.txt'));
Code: Select all
$db = &$mod->dbHandle;
$seq = $db->GenID(cms_db_prefix(). 'module_fb_uniquefield_seq');
$filespec = $this->GetOption('fileroot',$options['uploads_root']).'/'.
preg_replace($this->GetOption('filespec',$seq));
Code: Select all
$db = &$mod->dbHandle;
$seq = $db->GenID(cms_db_prefix(). 'module_fb_uniquefield_seq');
$filespec = $seq;
-
- Forum Members
- Posts: 50
- Joined: Fri Jan 16, 2009 1:07 pm
Re: FormBuilder: Flat file name by variable
I wish I could have replied that I solved this.. but I haven't..
No one have a slightest idea how to best get this to work?
No one have a slightest idea how to best get this to work?
-
- Forum Members
- Posts: 50
- Joined: Fri Jan 16, 2009 1:07 pm
Re: FormBuilder: Flat file name by variable
I'm back to this issue. Anyone that could take second to help me out?
Re: FormBuilder: Flat file name by variable
If you want to use Smarty variables in the filespec, you could try doing something like:
Good luck,
___Samuel___
Code: Select all
$filespec = $this->GetOption('fileroot',$options['uploads_root']).'/'.
preg_replace("/[^\w\d\.]|\.\./", "_", $this->GetOption('filespec','form_submissions.txt'));
$filespec= $mod->ProcessTemplateFromData( $filespec);
Good luck,
___Samuel___
Many modules available from the http://dev.cmsmadesimple.org
The CMS Made Simple Developer Cookbook is now available from Packt Publishers!
The CMS Made Simple Developer Cookbook is now available from Packt Publishers!