php - How can I add a link to a table in Smarty? -
i have requirement output table using smarty , have user select row take them page.
i can display table fine:
{html_table cols="job title,salary,sector,location" loop=$results}
which gives:
<table border="1"> <thead> <tr> <th>job title</th> <th>salary</th> <th>sector</th> <th>location</th> </tr> </thead> <tbody> <tr> <td>dog walker</td> <td>20000</td> <td>none</td> <td>london</td> </tr> <tr> <td>f1 driver</td> <td>10000000</td> <td>financial services</td> <td>scotland</td> </tr> </tbody> </table>
but not sure if possible add hyperlink additional column table links page using hidden id.
so want link this:
<table border="1"> <thead> <tr> <th>job title</th> <th>salary</th> <th>sector</th> <th>location</th> <th>apply</th> </tr> </thead> <tbody> <tr> <td>dog walker</td> <td>20000</td> <td>none</td> <td>london</td> <td><a href="/apply/1">apply</a></td> </tr> <tr> <td>f1 driver</td> <td>10000000</td> <td>financial services</td> <td>scotland</td> <td><a href="/apply/23">apply</a></td> </tr> </tbody> </table>
is possible?
yes, need modify $results
array before pass smarty 4th element of each row contains link string. there's no way have {html_table}
generate link you.
Comments
Post a Comment