Part of the EllisLab Network

Bug Report

Multiple replacement of variable pairs (same variable name) fails

Date: 07/01/2009 Severity: Minor
Status: New Reporter: Schotte
Version: 1.7.2 SVN
Keywords: Libraries, Template Parser Class

Description

There seems to be a problem when you want to reuse a variable (array) multiple times in one view. Only the first instance of the variable pair will get replaced. The second will just be shown as the content between the variable pairs plus the delimiter. (see example below).

Code Sample

(controller)

$aData['items'][] = array('title' => 1, 'short_title' => 2);
$aData['items'][] = array('title' => 3, 'short_title' => 4);
$aData['items'][] = array('title' => 5, 'short_title' => 6);

$this->parser->parse('my_view', $aData);

(
view)
<
h1>My View</h1>
<
h2>News</h2>
{items}
  
<h3>{title}<h3>
  <!--
more variables -->
{/items}

<!-- some more html in between -->
<
ul>
{items}
  
<li>{short_title}</li>
{/items}
</ul>

Expected Result

<h1>My View</h1>

News

  <h3>1<h3>
  <!—more variables—>
  <h3>3<h3>
  <!—more variables—>
  <h3>5<h3>
  <!—more variables—>


<!—some more html in between—>
<ul>
  <li>2</li>
  <li>4</li>
  <li>6</li>
</ul>

Actual Result

<h1>My View</h1>

News

  <h3>1<h3>
  <!—more variables—>
  <h3>3<h3>
  <!—more variables—>
  <h3>5<h3>
  <!—more variables—>


<!—some more html in between—>
<ul>
  <li></li>
  {/items}
</ul>

Comment on Bug Report

Name:

Email:

Location:

URL:

Remember my personal information

Notify me of follow-up comments?