关于ecshop的smarty问题
本帖最后由 u011850217 于 2014-07-19 13:01:06 编辑 这是ecshop手机端的index模板的一段代码
1 2 3 4 5 6 | <br>define( 'IN_ECS' , true);<br> require (dirname( __FILE__ ) . '/includes/init.php' );<br> $type = ! empty ( $_GET [ 'type' ]) ? $_GET [ 'type' ] : 'best' ;<br> if ( $type != 'best' && $type != 'promote' && $type != 'hot' && $type != 'new' )<br>{<br> $type = 'best' ;<br>}<br> $smarty ->assign( 'type' , $type );<br><br> if ( empty ( $_GET [ 'order_price' ]))<br>{<br> $order_rule = 'ORDER BY shop_price ASC, g.last_update DESC' ;<br>}<br> else <br>{<br> $order_rule = 'ORDER BY shop_price DESC, g.last_update DESC' ;<br>}<br><br> if ( $type == 'promote' )<br>{<br> $goods = wap_get_promote_goods( $order_rule );<br>}<br> else <br>{<br> $goods = wap_get_recommend_goods( $type , $order_rule );<br>}<br><br> $num = count ( $goods );<br> if ( $num > 0)<br>{<br> foreach ( $goods as $key => $data )<br> {<br> $sort_array [ $data [ 'id' ]] = $key ;<br> }<br> $page_num = '10' ;<br> $page = ! empty ( $_GET [ 'page' ]) ? intval ( $_GET [ 'page' ]) : 1;<br> $pages = ceil ( $num / $page_num );<br> if ( $page {<br> $page = 1;<br> }<br> if ( $pages == 0)<br> {<br> $pages = 1;<br> }<br> if ( $page > $pages )<br> {<br> $page = $pages ;<br> }<br> $i = 1;<br> foreach ( $sort_array as $goods_key )<br> {<br> if (( $i > ( $page_num * ( $page - 1 ))) && ( $i {<br> $price = empty ( $goods [ $goods_key ][ 'promote_price_org' ]) ? $goods [ $goods_key ][ 'shop_price' ] : $goods [ $goods_key ][ 'promote_price' ];<br>
</div>
|
Nach dem Login kopieren