Dear all,
I have a problem when creating table layout within TCPDF. The a href link on the result is not clickable, I'm using this code to generate the table
Thank you[file=10346]Table-PDF_20180403073858.pdf[/file]
I have a problem when creating table layout within TCPDF. The a href link on the result is not clickable, I'm using this code to generate the table
<table border="1" cellpadding="3">However, when I try to use custom code, It works well.
<thead>
<tr>
<th bgcolor="#a3d0f7">BERKAS</th>
<th bgcolor="#a3d0f7">URL</th>
</tr>
</thead>
<tbody>
<?php
foreach ( $form->data['syarat'] as $p ) {
echo "<tr>
<td>{$p['nama_file']}</td>
<td><a href={$p['url_berkas']}>Download</a></td>
</tr>";
}
?>
</tbody>
</table>
Thank you[file=10346]Table-PDF_20180403073858.pdf[/file]
Hi Yudhizth ,
Please try adding quotes round the URL. <td><a href="{$p['url_berkas']}" >Download</a></td>
Bob
Please try adding quotes round the URL. <td><a href="{$p['url_berkas']}" >Download</a></td>
Bob
Thank you Bob,
I try to add quotes, but it becomes a blank pdf. [file=10347]Table-PDF_20180403172741.pdf[/file]
This is the debugger result without TcPDF action
I try to add quotes, but it becomes a blank pdf. [file=10347]Table-PDF_20180403172741.pdf[/file]
This is the debugger result without TcPDF action
Array ( [option] => com_chronoforms5 [chronoform] => Table-PDF [event] => submit [button1] => Submit [syarat] => Array ( [0] => Array ( [id_berkas] => 1 [uniq_id] => 0833ab9790e48949c01e2bac6fbb650e845b12d0 [user_id] => 0 [created] => 2016-03-31 07:52:10 [modified] => [url_berkas] => http://localhost/jom/components/com_chronoforms5/chronoforms/uploads/save-dibelakang/20160331075210_pdf-sample.pdf [status] => 0 [id_permohonan] => [nama_file] => ) [1] => Array ( [id_berkas] => 2 [uniq_id] => e1b271371b7d7e39c5b6ff73965afbf1e89be55c [user_id] => 0 [created] => 2017-08-11 07:46:23 [modified] => [url_berkas] => http://localhost/jom/components/com_chronoforms5/chronoforms/uploads/demo-fields-multiplier-des/20170811074623_file1.pdf [status] => [id_permohonan] => [nama_file] => yudhi ) [2] => Array ( [id_berkas] => 3 [uniq_id] => 6990f14b15eb8f24d39cd94fc3565a241da081c9 [user_id] => 0 [created] => 2017-08-11 07:46:23 [modified] => [url_berkas] => http://localhost/jom/components/com_chronoforms5/chronoforms/uploads/demo-fields-multiplier-des/20170811074623_file2.pdf [status] => [id_permohonan] => [nama_file] => setiawan ) [3] => Array ( [id_berkas] => 4 [uniq_id] => 320f5e601a55a5977fc1f6ffd850b3c17d8d1cb1 [user_id] => 0 [created] => 2017-08-11 07:48:10 [modified] => [url_berkas] => http://localhost/jom/components/com_chronoforms5/chronoforms/uploads/demo-fields-multiplier-des/20170811074810_file1.pdf [status] => [id_permohonan] => [nama_file] => Salinan Izin Penyelenggaraan ke 0 ) [4] => Array ( [id_berkas] => 5 [uniq_id] => cdcdef28e02fdaf2280a2037560f2db249b75ddb [user_id] => 0 [created] => 2017-08-11 07:48:10 [modified] => [url_berkas] => http://localhost/jom/components/com_chronoforms5/chronoforms/uploads/demo-fields-multiplier-des/20170811074810_file2.pdf [status] => [id_permohonan] => [nama_file] => Salinan Izin Penyelenggaraan ke 2 ) [5] => Array ( [id_berkas] => 6 [uniq_id] => 6f3508c1237d2d150ac3fcb60e0da5a3522e5def [user_id] => 0 [created] => 2017-08-11 07:48:10 [modified] => [url_berkas] => http://localhost/jom/components/com_chronoforms5/chronoforms/uploads/demo-fields-multiplier-des/20170811074810_file3.pdf [status] => [id_permohonan] => [nama_file] => Salinan Izin Penyelenggaraan ke 3 ) [6] => Array ( [id_berkas] => 7 [uniq_id] => e5c61a104e8e8eb90c9ec29233a12d5502e6c5db [user_id] => 0 [created] => 2017-08-11 07:54:06 [modified] => [url_berkas] => http://localhost/jom/components/com_chronoforms5/chronoforms/uploads/demo-fields-multiplier-des/20170811075406_file1.pdf [status] => [id_permohonan] => [nama_file] => Salinan Izin Penyelenggaraan ke 1 ) [7] => Array ( [id_berkas] => 8 [uniq_id] => 4f38e19d8e8b6c4353eff412909ed82fe50c863d [user_id] => 0 [created] => 2017-08-11 07:54:06 [modified] => [url_berkas] => http://localhost/jom/components/com_chronoforms5/chronoforms/uploads/demo-fields-multiplier-des/20170811075406_file2.pdf [status] => [id_permohonan] => [nama_file] => Salinan Izin Penyelenggaraan ke 2 ) [8] => Array ( [id_berkas] => 9 [uniq_id] => faba16b9c7a28682f5308740a2f2ae43ba6f3ae9 [user_id] => 0 [created] => 2017-08-11 07:54:06 [modified] => [url_berkas] => http://localhost/jom/components/com_chronoforms5/chronoforms/uploads/demo-fields-multiplier-des/20170811075406_file3.pdf [status] => [id_permohonan] => [nama_file] => Salinan Izin Penyelenggaraan ke 3 ) [9] => Array ( [id_berkas] => 10 [uniq_id] => 8cc22579bdd43ded98d12caf98f38d275a62360f [user_id] => 0 [created] => 2017-11-20 05:36:11 [modified] => [url_berkas] => http://localhost/jom/components/com_chronoforms5/chronoforms/uploads/Fileupload-bugs/20171120053611_file1.pdf [status] => [id_permohonan] => [nama_file] => Wakwaw ) [10] => Array ( [id_berkas] => 11 [uniq_id] => 659fd91a176695691fc2b459a20e2bad508be001 [user_id] => 0 [created] => 2017-11-20 05:36:36 [modified] => [url_berkas] => http://localhost/jom/components/com_chronoforms5/chronoforms/uploads/Fileupload-bugs/20171120053636_file3.pdf [status] => [id_permohonan] => [nama_file] => Wakwaw ) [11] => Array ( [id_berkas] => 12 [uniq_id] => 8569897348f7057b04a842c7f51eff16c2121bb5 [user_id] => 0 [created] => 2017-11-20 05:42:30 [modified] => [url_berkas] => http://localhost/jom/components/com_chronoforms5/chronoforms/uploads/Fileupload-bugs/20171120054230_file19.pdf [status] => [id_permohonan] => [nama_file] => Wakwaw ) [12] => Array ( [id_berkas] => 13 [uniq_id] => 06c8333d01258c2440ef939f1862e1639f836ea8 [user_id] => 0 [created] => 2018-03-01 04:53:43 [modified] => [url_berkas] => http://localhost/jom/components/com_chronoforms5/chronoforms/uploads/demo-fields-multiplier-des/20180301045343_file3.pdf [status] => [id_permohonan] => [nama_file] => Salinan Izin Penyelenggaraan ke 1 ) [13] => Array ( [id_berkas] => 14 [uniq_id] => 3ec237ffc3bab7fe7b329668d26987cc0cf878aa [user_id] => 0 [created] => 2018-03-01 04:53:43 [modified] => [url_berkas] => http://localhost/jom/components/com_chronoforms5/chronoforms/uploads/demo-fields-multiplier-des/20180301045343_file6.pdf [status] => [id_permohonan] => [nama_file] => Salinan Izin Penyelenggaraan ke 2 ) ) )
Hi Yudhizth,
I'm not sure that PHP works well inside the TCPDF template - please try building the table in a Custom Code action before the TCPDF action, save it to the $form->data array as say $form->data['file_table'] then add that new element in the TCPDF template.
Bob
I'm not sure that PHP works well inside the TCPDF template - please try building the table in a Custom Code action before the TCPDF action, save it to the $form->data array as say $form->data['file_table'] then add that new element in the TCPDF template.
Bob
Thanks Bob,
Finally I found the solution, just like your advice. Here is the code
Thank you.
Finally I found the solution, just like your advice. Here is the code
<?php
$db = JFactory::getDbo();
//$id = JRequest::getString('id', '', 'post');
// Create a new query object.
$query = $db->getQuery(true);
$query = "SELECT * FROM xsd7p_t_berkas";
// Reset the query using our newly populated query object.
$db->setQuery($query);
$db->query();
$jumlah = $db->getNumRows();
$results = $db->loadObjectList();
if ($jumlah < 1) {
echo "Data tidak ditemukan";
}else{
$table = '';
$table .= '<table border="1" cellpadding="3">';
$table .= '<tr>';
$table .= '<td bgcolor="#a3d0f7">BERKAS</td>';
$table .= '<td bgcolor="#a3d0f7">URL BERKAS</td>';
$table .= '</tr>';
foreach ($results as $row) {
$table .= '<tr>';
$table .= '<td>'.$row->nama_file.'</td>';
$table .= '<td><a href="'.$row->url_berkas.'">Download</a></td>';
$table .= '</tr>';
}
$table .='</table>';
$form->data["code"] = $table;
}
?>
Thank you.
This topic is locked and no more replies can be posted.