编辑:确定让我更清楚我有一个HTML文件的名称file.html就是这个样子了一下:如何循环子类别与他们的类别?
{}类{ } sybcategory
和我有一个索引文件是像这个:
class template { var $ page;
function add_file($file){
$this->page = file_get_contents($file);
return $this->page;
}
function vars($array)
{
foreach($array as $key => $value)
{
$this->page = str_replace('{'.$key.'}', $value, $this->page);
}
echo $this->page;
}
}
$模板=新的模板();
$ template-> add_file('file.html'); ('category'=> $ row_cat ['title'],'subcategory'=> $ row_subcat ['title']));}};}};}};}};
现在,这只输出标题和子类别一次我如何循环,我没有在这里添加mysql查询,因为我不想浪费你的更多时间,请如果你知道如何去做,然后让我知道。
为什么要移除'while-loops'标签?它比'mysql'更有意义。 – 2011-04-07 20:02:49
感谢您的更新 - 完全取决于您使用的模板系统? Smarty有什么机会? – 2011-04-09 20:36:49
不,我做了一个模板引擎我的自我 – 2011-04-10 07:11:26