CodeIgniter Forums
Parser loop not working if you have 2 identical loops with slightly different code - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Parser loop not working if you have 2 identical loops with slightly different code (/thread-48524.html)



Parser loop not working if you have 2 identical loops with slightly different code - El Forum - 01-19-2012

[eluser]iKode[/eluser]
I hope that title was descriptive enough, the parser does not seem to work in this case

Code:
<p>Male Age</p>
{age}
<p>&lt;input type="checkbox" name="search[]"  value="{id}" id="m_id_{id}"  /&gt; <label for="m_id_{id}">{label}</label></p>
{/age}

<p>Female Age</p>
{age}
<p>&lt;input type="checkbox" name="search[]"  value="{id}" id="f_id_{id}"  /&gt; <label for="f_id_{id}">{label}</label></p>
{/age}

It will render the first loop , but not the second. if I do the following ( obviously its wrong to have 2 identical label ids ) the parser will work.

Code:
<p>Male Age</p>
{age}
<p>&lt;input type="checkbox" name="search[]"  value="{id}" id="id_{id}"  /&gt; <label for="id_{id}">{label}</label></p>
{/age}


<p>Female Age</p>
{age}
<p>&lt;input type="checkbox" name="search[]"  value="{id}" id="id_{id}"  /&gt; <label for="id_{id}">{label}</label></p>
{/age}

The only difference I see is that inside of the loop is different. This is the output:



Male Age
18-24
25-29
30-39
40-49
50+


Female Age
{age}
{value}
{/age}


Any ideas?


Parser loop not working if you have 2 identical loops with slightly different code - El Forum - 06-25-2012

[eluser]popovich[/eluser]
This question is quite old, but it is on my list right now. Any workarounds or tips?