色欲av免费一区二区三区|人妻丰满熟妇av欧无码区免费|免费看A片无码不卡福利视频6080|久久京东热AV男人的天堂|

            <sub id="j9vn7"><nobr id="j9vn7"></nobr></sub>

                  <form id="j9vn7"><nobr id="j9vn7"></nobr></form>

                      <address id="j9vn7"></address>

                          <address id="j9vn7"></address>

                            <form id="j9vn7"></form>
                            <form id="j9vn7"><nobr id="j9vn7"><nobr id="j9vn7"></nobr></nobr></form>

                            <form id="j9vn7"></form>

                              <form id="j9vn7"></form>

                              中山php|最優網絡中山做網站 中山php建站

                              最優良人

                              2012/09/22 at 11:54

                              smarty模版使用php標簽,如何獲取模版變量

                              已經assign一個模版變量$assign,由于要做特殊的循環輸出,使用for循環,因此使用到了php標簽,但是php語句和模版語句的變量作用域是不同的,因此不能直接獲取到

                              {{php}}

                              for($i=0;$i<count($assign);$i=$i+2){
                              echo '
                              <ul>
                              <li> <span class="zz_pic"><a href="'._url('picture',array('col_key'=>'cert','pic_id'=>$assign[$i][pic_id])).'" title=""><img src="uploads/thumb_'.$assign[$i][pic].'" alt=""></a></span> <span class="zz_title"><a href="'._url('picture',array('col_key'=>'cert','pic_id'=>$assign[$i][pic_id])).'" title="">'.$assign[$i][title].'</a></span> </li>
                              <li> <span class="zz_pic"><a href="'._url('picture',array('col_key'=>'cert','pic_id'=>$assign[$i+1][pic_id])).'" title=""><img src="uploads/thumb_'.$assign[$i+1][pic].'" alt=""></a></span> <span class="zz_title"><a href="'._url('picture',array('col_key'=>'cert','pic_id'=>$assign[$i+1][pic_id])).'" title="">'.$assign[$i+1][title].'</a></span> </li>i>

                              </ul>';}
                              {{/php}}

                              解決的方法是:模版變量全部存在smarty的一個對象里面;只要在for之前進行賦值:$assign = $this->_tpl_vars[assign];

                              {{php}}
                              $assign = $this->_tpl_vars[assign];
                              for($i=0;$i<count($assign);$i=$i+2){
                              echo '
                              <ul>
                              <li> <span class="zz_pic"><a href="'._url('picture',array('col_key'=>'cert','pic_id'=>$assign[$i][pic_id])).'" title=""><img src="uploads/thumb_'.$assign[$i][pic].'" alt=""></a></span> <span class="zz_title"><a href="'._url('picture',array('col_key'=>'cert','pic_id'=>$assign[$i][pic_id])).'" title="">'.$assign[$i][title].'</a></span> </li>
                              <li> <span class="zz_pic"><a href="'._url('picture',array('col_key'=>'cert','pic_id'=>$assign[$i+1][pic_id])).'" title=""><img src="uploads/thumb_'.$assign[$i+1][pic].'" alt=""></a></span> <span class="zz_title"><a href="'._url('picture',array('col_key'=>'cert','pic_id'=>$assign[$i+1][pic_id])).'" title="">'.$assign[$i+1][title].'</a></span> </li>i>

                              </ul>';}
                              {{/php}}

                              標簽:,
                              -

                                        <sub id="j9vn7"><nobr id="j9vn7"></nobr></sub>

                                              <form id="j9vn7"><nobr id="j9vn7"></nobr></form>

                                                  <address id="j9vn7"></address>

                                                      <address id="j9vn7"></address>

                                                        <form id="j9vn7"></form>
                                                        <form id="j9vn7"><nobr id="j9vn7"><nobr id="j9vn7"></nobr></nobr></form>

                                                        <form id="j9vn7"></form>

                                                          <form id="j9vn7"></form>