Hi,
I am trying to explode or split a Multi-file-select comma separated string from CF6 into CC6 table with the download links and their belonging link paths. Is this possible?
Up till now I mixed a lot of views and components with straight php or shortcodes with poor results. The URL: {path/url:}/uploads/{var:read_article.Article.file20} only gets one correct but double quoted filepath. The read_article function does not seem to respond to {data.split:string} nor does php explode. Also {data:[0].file20} gives nothing.
Is there, by any chance, more information to this matter? Or another example concerning Multi-file-select upload in CF6 to Download function in CC6? Also tried the latter from Files->Download, but how to individually connect to comma separated values? Just a pointer in the right direction would be greatly appreciated.
Thanks,
Marty
I am trying to explode or split a Multi-file-select comma separated string from CF6 into CC6 table with the download links and their belonging link paths. Is this possible?
Up till now I mixed a lot of views and components with straight php or shortcodes with poor results. The URL: {path/url:}/uploads/{var:read_article.Article.file20} only gets one correct but double quoted filepath. The read_article function does not seem to respond to {data.split:string} nor does php explode. Also {data:[0].file20} gives nothing.
Is there, by any chance, more information to this matter? Or another example concerning Multi-file-select upload in CF6 to Download function in CC6? Also tried the latter from Files->Download, but how to individually connect to comma separated values? Just a pointer in the right direction would be greatly appreciated.
Thanks,
Marty
Hi Marty,
Please try adding a Debugger action, that will show you the data that is available when the form submits. I'm pretty sure that the file data is returned as an array. If you are seeing a comma separated list maybe you have a Handle Arrays action there somewhere?
Bob
Please try adding a Debugger action, that will show you the data that is available when the form submits. I'm pretty sure that the file data is returned as an array. If you are seeing a comma separated list maybe you have a Handle Arrays action there somewhere?
Bob
Hi Bob,
The ChronoForms6 Debugger shows an array for the Event and the Upload, but the Save Data shows: [file20] => ["20180816073812_jvb-oppo-logo.png","20180816073812_logo.png","20180816073812_qinas-logo.png"]
For some reason ChronoConnectivity6 does not allow me to Read Data in a Function Where conditions get those specific array keys. I tried dozens of shortcodes and php actions. Is this the right way to create the correct download links in the table?
Thanks,
Martijn
The ChronoForms6 Debugger shows an array for the Event and the Upload, but the Save Data shows: [file20] => ["20180816073812_jvb-oppo-logo.png","20180816073812_logo.png","20180816073812_qinas-logo.png"]
For some reason ChronoConnectivity6 does not allow me to Read Data in a Function Where conditions get those specific array keys. I tried dozens of shortcodes and php actions. Is this the right way to create the correct download links in the table?
Thanks,
Martijn
Hi Martijn,
I am not clear exactly what you are doing here.
It looks as though the file upload data - or part of it - is being converted from an array to a string. If ChronoForms is doing this automatically then you may need to unseparate that before saving - use a PHP code action with explode().
What is actually being saved in the table and what do you want to be saved?
Bob
I am not clear exactly what you are doing here.
It looks as though the file upload data - or part of it - is being converted from an array to a string. If ChronoForms is doing this automatically then you may need to unseparate that before saving - use a PHP code action with explode().
What is actually being saved in the table and what do you want to be saved?
Bob
Hi Bob,
The ChronoForms6 multi-file table saves: ["20180813144741_10us33q.jpg","20180813144741_avatar-720.png","20180813144741_barcode-image.jpg"]
ChronoConnectivity6 shows exactly this when using {var:articles_list.row.Article.file20}
I want CC6 to show the three filenames with download links. Where do I put the explode function?
Thanks,
Martijn
The ChronoForms6 multi-file table saves: ["20180813144741_10us33q.jpg","20180813144741_avatar-720.png","20180813144741_barcode-image.jpg"]
ChronoConnectivity6 shows exactly this when using {var:articles_list.row.Article.file20}
I want CC6 to show the three filenames with download links. Where do I put the explode function?
Thanks,
Martijn
Hi Martijn,
I'm not very experienced with CCv6 :-( In CCv5 I would have used the PHP box to read that value, explode it into an array, wrap the values with the <a> link HTML, then implode it back to an array of links.
Bob
I'm not very experienced with CCv6 :-( In CCv5 I would have used the PHP box to read that value, explode it into an array, wrap the values with the <a> link HTML, then implode it back to an array of links.
Bob
Hi Bob,
I was hoping for a more integrated solution, but here is a possible PHP Function:
Thanks,
Martijn
I was hoping for a more integrated solution, but here is a possible PHP Function:
$db = JFactory::getDbo();The function executes, but how do I make this work within ChronoConnectivity6 Link View URL Parameters while passing the (U)ID like {path/url:}/uploads/{var:articles_list.row.Article.aid} ? Or do I need to create another Function to retrieve the PHP Function? Mixing up shortcodes and PHP is not possible, is it?
$query = $db->getQuery(true);
$query->select($db->quoteName(array('file20')));
$query->from($db->quoteName('#__chronoforms_data_direct-contact'));
$query->where($db->quoteName('aid')." = ".'12'); // <- becomes $aid
$db->setQuery($query);
$column= $db->loadColumn(0);
//print_r($column);
$column[0] = trim(column[0], ' ');
$column[0] = str_replace('"', '', $column[0]);
$columnBits = explode(",", $column[0]);
//echo "$column[0]<br />";
echo "$columnBits[0]<br />";
echo "$columnBits[1]<br />";
echo "$columnBits[2]";
Thanks,
Martijn
This topic is locked and no more replies can be posted.