<?php
$html = '<!--HEAD--><p class="listing-grp-title">Top Ranked Offers</p><!--HEAD-->
<!--WRAPPERSTART--><div><table><!--WRAPPERSTART-->
<tr class="{% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}">
<td class="rank"># {{forloop.counter}}</td>
<td class="logo">
<img src="{{ad.display_url}}" width="120" height="40" alt="Aig Sml"/>
</td>
<td>
<p class="offer">{{ad.headline}}</p>
{{ad.body|safe}}
</td>
<td>
<img src="images/arrow.png" width="14" height="18" alt=""/>
</td>
<td class="end">
<a href="#"><img class="button" src="images/sml-btn.png" width="112" height="30" alt=""/></a>
</td>
</tr>
<!--WRAPPEREND--></table></div><!--WRAPPEREND-->';
$sub= 'sub_0_';
$htmlp = _format_special_tags($html,$sub);
_remove_between('<!--HEAD-->',$htmlp);
_remove_between('<!--WRAPPERSTART-->',$htmlp);
_remove_between('<!--WRAPPEREND-->',$htmlp);
function _format_special_tags($html,$sub) {
//where sub is sub_1_ or similar
$tags = array();
$outer= "{% if forloop.counter = ".$sub."range.0 %}";
$end_outer = "{% endif %}";
$header = _return_between('<!--HEAD-->',$html);
$wrapper_start = _return_between('<!--WRAPPERSTART-->',$html);
$wrapper_end = _return_between('<!--WRAPPEREND-->',$html);
$html = $outer.(($header)?$header:'').(($wrapper_start)?$wrapper_start:'').$end_outer.$html.$outer.(($wrapper_end)?$wrapper_end:'').$end_outer;
return $html;
}
function _return_between($tag,$subject) {
$split = explode($tag,$subject,3);
return (isset($split[1]))?$split[1]:false;
}
function _remove_between($tag,$subject) {
echo preg_replace("/".$tag.".+?".$tag."/i", "", $subject);
}
- Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- {% if forloop.counter = sub_0_range.0 %}<p class="listing-grp-title">Top Ranked Offers</p><div><table>{% endif %}
<!--WRAPPERSTART--><div><table><!--WRAPPERSTART-->
<tr class="{% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}">
<td class="rank"># {{forloop.counter}}</td>
<td class="logo">
<img src="{{ad.display_url}}" width="120" height="40" alt="Aig Sml"/>
</td>
<td>
<p class="offer">{{ad.headline}}</p>
{{ad.body|safe}}
</td>
<td>
<img src="images/arrow.png" width="14" height="18" alt=""/>
</td>
<td class="end">
<a href="#"><img class="button" src="images/sml-btn.png" width="112" height="30" alt=""/></a>
</td>
</tr>
<!--WRAPPEREND--></table></div><!--WRAPPEREND-->{% if forloop.counter = sub_0_range.0 %}</table></div>{% endif %}{% if forloop.counter = sub_0_range.0 %}<p class="listing-grp-title">Top Ranked Offers</p><div><table>{% endif %}<!--HEAD--><p class="listing-grp-title">Top Ranked Offers</p><!--HEAD-->
<tr class="{% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}">
<td class="rank"># {{forloop.counter}}</td>
<td class="logo">
<img src="{{ad.display_url}}" width="120" height="40" alt="Aig Sml"/>
</td>
<td>
<p class="offer">{{ad.headline}}</p>
{{ad.body|safe}}
</td>
<td>
<img src="images/arrow.png" width="14" height="18" alt=""/>
</td>
<td class="end">
<a href="#"><img class="button" src="images/sml-btn.png" width="112" height="30" alt=""/></a>
</td>
</tr>
<!--WRAPPEREND--></table></div><!--WRAPPEREND-->{% if forloop.counter = sub_0_range.0 %}</table></div>{% endif %}{% if forloop.counter = sub_0_range.0 %}<p class="listing-grp-title">Top Ranked Offers</p><div><table>{% endif %}<!--HEAD--><p class="listing-grp-title">Top Ranked Offers</p><!--HEAD-->
<!--WRAPPERSTART--><div><table><!--WRAPPERSTART-->
<tr class="{% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}">
<td class="rank"># {{forloop.counter}}</td>
<td class="logo">
<img src="{{ad.display_url}}" width="120" height="40" alt="Aig Sml"/>
</td>
<td>
<p class="offer">{{ad.headline}}</p>
{{ad.body|safe}}
</td>
<td>
<img src="images/arrow.png" width="14" height="18" alt=""/>
</td>
<td class="end">
<a href="#"><img class="button" src="images/sml-btn.png" width="112" height="30" alt=""/></a>
</td>
</tr>
{% if forloop.counter = sub_0_range.0 %}</table></div>{% endif %}
preferences:
344.9 ms | 413 KiB | 399 Q