Php 如何在Smarty中向表添加链接?

Php 如何在Smarty中向表添加链接?,php,smarty,Php,Smarty,我需要使用Smarty输出一个表,然后让用户选择一行将它们带到另一个页面 我可以很好地显示表格: {html_table cols="Job Title,Salary,Sector,Location" loop=$results} 其中: <table border="1"> <thead> <tr> <th>Job Title</th> <th>

我需要使用Smarty输出一个表,然后让用户选择一行将它们带到另一个页面

我可以很好地显示表格:

{html_table cols="Job Title,Salary,Sector,Location" loop=$results}
其中:

<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> 

职位名称
薪水
部门
位置
遛狗者
20000
没有一个
伦敦
F1车手
10000000
金融服务
苏格兰
但我不确定是否可以将超链接作为附加列添加到使用隐藏id链接到页面的表中

所以我想要一些链接:

<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> 

职位名称
薪水
部门
位置
申请
遛狗者
20000
没有一个
伦敦
F1车手
10000000
金融服务
苏格兰

可能吗?

是的,但在将
$results
数组传递给Smarty之前,需要修改该数组,以便每行的第4个元素将链接作为字符串包含。没有办法让
{html\u table}
为您生成链接。

所以构建html并将其作为数组的元素传递?是的,完全正确。数组元素应该是类似于
的字符串。