php分解函数未在页面上执行


php explode function not executing on the page

尝试在页面上创建一个列表视图,其中包含类似的内容

1.制作

2型号

3 说明

大约有150个这样的品牌,通过分页在列表视图中添加相应的型号和简短描述,大约有15或20个项目

我正在尝试计算页面上的各个列表,并在每一页上的第7个和第12个列表之后创建一个潜在客户表单视图

然而,尽管所有列表都显示在页面中,但分解功能没有执行,在第7和第12个列表之后没有显示这样的主视图

以下是通过php爆炸函数尝试的代码,其中

<div class="pageing-box-right box-number">
    <div class="pagination pageing-container"><ul>
        <?php echo $this->pagination->getListFooter(); ?></ul>
        <ul><?php //echo $this->pagination->getLimitBox(); ?></ul>
    </div>
</div>
<?php foreach ($this->items as $i => $item) : ?>
    <?php $canEdit = $user->authorise('core.edit', 'com_toys'); ?>
        <?php if (isset($this->items[0]->state)) : ?>
        <?php $class = ($canChange) ? 'active' : 'disabled'; ?>
        <?php endif; ?>
<h3> <?php echo $this->escape($item->n_make); ?>  <?php echo $item->n_model; ?> </h3>
<p> <?php echo $item->n_month; ?>   <?php echo $item->n_year; ?> </p>
<p> <?php echo $item->n_short_description; ?> </p>
<hr/>
        <?php endforeach; ?>
<?php
    $listings = explode("<hr/>", $item->n_make);
    $numberOfListings = count($listings);
    $Reset =1;
    for($i = 0; $i < $numberOfListings; ++$i) 
    {
        if ($Reset == 7)
        { ?> 
        <div style="margin: 0 500px 5px 12px; float: left;">
        <p> Test create form view 1 of lead </p>
  </div>
   <hr />
<p></p>
   <?php } if ($Reset == 12) { ?> 
   <div style="margin: 0 500px 5px 12px; float: left;">
   <p> Test Create Form View 2 of lead </p>
        </br></hr>
   </div>
   <hr />
<p></p>
    <?php }
         echo $listings[$i] . "<hr/>";
         if($Reset>15){
                $Reset =1;
          }
          $Reset++;
    }
    ?>

我相信问题出在下面代码的这一行

 $listings = explode("<hr/>", $item->n_make);

有人能帮上忙吗

这是上市视图-请参阅我希望在6/7上市后合并的主要视图

Fisher Soft Toys
August 2016
Fisher toys are available at Bernado Store @ 10% Discount
-------------------------------------------
Trudi Soft Toys
August 2016
Trudi Peppy Bear now available. First Order will get first delivery
----------------------------------------------
Hamleys Princess Girl
August 2016
Hamleys Princess girl long awaited is now available online
-----------------------------------------------------------
Acctu
August 2016
Acctu Toys now available for sale in Japan
---------------------------------------------
Bernado Soft Toys
August 2016
Bernado toys are available at Bernado Store @ 10% Discount
-------------------------------------------
V Soft Toys
August 2016
V Bear now available. First Order will get first delivery
----------------------------------------------
**Lead View**
Send you Inquiry now by calling up 001 - 9999999999 or email on - xyz@yahoo.com
 ------------------------------------------------ 
Jo Princess Girl
August 2016
Jo Princess girl long awaited is now available online
-----------------------------------------------------------
Acctu
August 2016
Acctu Toys now available for sale in Japan

使用此正则表达式查找您要查找的内容:

preg_match_all("/(.*?)'s+(?:January|Feburary|March|April|May|June|July|August|September|October|November|December) 'd{4}/", $item->n_make, $matches);
$listings = array_map($matches, function($match) {
    return $match[1];
});
//$listings should be an array looking like:
//array('Fisher Soft Toys', 'Trudi Soft Toys', 'Hamleys Princess Girl', etc...)