【发布时间】:2014-07-08 10:56:37
【问题描述】:
我想在 smarty 循环中显示一些类似标题的查询:
table1 (courses): id, title
table2 (questions): id, title, teachers_id
查询:
$this->ctitle_qtitle = DatabaseHandler::GetAll("
SELECT courses.title , questions.title
FROM courses
JOIN questions
ON courses.id = questions.courses_id ");
此查询有效,并且在 .tpl 文件中我使用循环:
{section name=i loop=$obj->ctitle_qtitle}
<tr>
<td><h3><a href="#">{$obj->ctitle_qtitle[i].title</a></h3></td>
<td>{$obj->ctitle_qtitle[i].title}</td>
<td><a href="#" class="ico del">Delete</a>
<a href="#" class="ico edit">Edit</a></td>
</tr>
{/section}
如何在 smarty 结果中使用 course.title 或 question.title ?
【问题讨论】:
-
var_dump($this->ctitle_qtitle);
标签: php mysql sql loops smarty