Hi Daniel,
If you don’t mind I would love to 
I’m a little lost as to where I am now myself though 
Template Code
{exp:test_conditionals}
<h3>{title}</h3>
<p>Qty = {qty}</p>
<p>Count - {count}</p>
<p>Results - {total_results}</p>
{if count == 2}
<p>This should hopefully show on the second iteration</p>
{/if}
{/exp:test_conditionals}
Plugin Code
<?php
$plugin_info = array(
'pi_name' => 'Test Conditionals',
'pi_version' => '1.0.0',
'pi_author' => 'Mark Bowen',
'pi_author_url' => 'http://www.markbowendesign.com/',
'pi_description' => 'Testing conditionals',
'pi_usage' => Test_conditionals::usage()
);
class Test_conditionals {
var $return_data = '';
function Test_conditionals()
{
global $TMPL, $DB, $SESS, $FNS;
$ids = array(1,2,3,4);
$count = 1;
$total_results = count($ids);
foreach ($ids as $count => $vars)
{
$tagdata = $TMPL->tagdata;
$vars['count'] = $count+1;
$vars['total_results'] = $total_results;
/** ----------------------------------------
/** Conditionals
/** ----------------------------------------*/
$tagdata = $FNS->prep_conditionals($tagdata, $vars);
foreach ($TMPL->var_single as $key => $val)
{
if ($key == "title")
{
$title = "Title";
$tagdata = $TMPL->swap_var_single($key, $title, $tagdata);
}
if ($key == "qty")
{
$qty = "2";
$tagdata = $TMPL->swap_var_single($key, $qty, $tagdata);
}
}
$this->return_data .= $tagdata;
}
}
// ----------------------------------------
// Plugin Usage
// ----------------------------------------
function usage()
{
ob_start();
?>
--- Plugin Tag ---
{exp:test_conditionals}
<p>{count}</p>
<p>{total_results}</p>
{/exp:test_conditionals}
<?php
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
}
// END
}
?>
I have renamed the plugin for now just whilst testing this all out so I don’t get so confused. This is the code I am currently working with. It exchanges the {title} and {qty} variables on the template for me but the only way I could get a count to spit out is by adding in another if ($key == “count”). This then gives me a count number but I can’t use it by doing this :
{if count == 2}
<p>Second iteration</p>
{/if}
It does work if I do :
{if "{count}" == 2}
<p>Second iteration</p>
{/if}
but I know that this is not the right thing to do. I’m quite at a loss now as I tried something out last night. I took the mod.query.php file and basically turned it into a plugin by renaming it to pi.query_test.php and then changing the class and function names inside to Query_test so that it would work as a plugin instead. It still did the exact same thing that it did as a module so I got to looking at the code in that file and I am pretty sure that I am doing the same thing in my plugin that is going on in there and yet they get a count variable which works in conditionals and mine just doesn’t want to play ball!!
All very frustrating!
Any help on this would be massively appreciated as I have now been through about 50 or so changes to the plugin, none of which are getting me anywhere closer to where I need to be! I’m sure I must be fairly close but just missing something really obvious here!
Thanks for any more help on this it really is appreciated a lot.
Best wishes,
Mark