How to simplify the following code

Source: Internet
Author: User
How to simplify the following code
if($_MODULE[huoqubaobei]!="4"){$i=-1;$j=0;    foreach($items as $item){$i++;        $itemUrl = $uriManager->detailURI($item);         $itemPicUrl = $item->getPicUrl(310);        $itemTitle = $item->title;        $itemPrice = $item->price;        $itemsoldCount = $item->soldCount; echo'

'.$itemTitle.'¥'.$itemPrice.'

';}}else if($_MODULE[huoqubaobei]=="4"){$num = count($srtpdz); for($i=0;$i<$num;$i++) {echo'

'.$srbbbt[$i].'¥'.$srbbjg[$i].'

';}}


In this case, p + css is repeatedly written .. I thought for a few hours and I couldn't think of a good way. The main reason is that this cycle hurts ..


Reply to discussion (solution)

Estimate how much it can't be squeezed.

Because the mixed coding is too complicated, the template engine appears.



'. $ Srbbbt [$ I].'
¥
'. $ Srbbjg [$ I].'



';

I don't want to repeat this.

Nobody knows ???????????????????????

I really want to output the echo code using another function.

How to simplify it won't save much code, that's all.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.