一聚教程网:一个值得你收藏的教程网站

热门教程

smarty模板 section用法

时间:2022-07-02 10:47:35 编辑:袖梨 来源:一聚教程网


php文件
                $vo = array();
            $trackback_i =0 ;
            $trackback_query = "SELECT t_id,title,t_datetime,t_excerpt,url,blog_name FROM table_tbacks where t_id='$article' ORDER BY t_datetime LIMIT 0,40";
            $idx = 0;
            $this->_db->query($trackback_query) ;
            while ($trackbacki_m_message = $this->_db->fetch_array($trackback_query))
            {
                $vo[] = $trackbacki_m_message;
                $trackback_i++;
             }
             $this->_tpl->assign('vo',$vo);
             $this->_tpl->assign('trackback_ti',$trackback_i);
//trackback end

            $this->_setTplCommon('g.tpl');
模板文件 g.tpl
<{if $trackback_ti !==0 }>

    trackback引用通告


<{section name=vo loop=$vo}>

感谢<{$vo[vo].title}>引用了本文,来自“<{$vo[vo].blog_name}>”,<{$vo[vo].excerpt}>
[阅读更多细节]
<{/section}>
<{/if}>

热门栏目