Hi, First of all apologies for cross posting this on the Community forum, but I’ve had no responses there so far.
I’m just writing my first module for a 1.6.9 installation.
I’m trying to specify variables as described (very nicely) in the v.2 docs here:
http://ellislab.com/expressionengine/user-guide/development/usage/template.html#parsing_variables
But I can’t work out from the 1.x docs how to do the same thing. Here’s my function code. I’d like the variable {member_id} to be populated on the resulting page
function memberList() {
global $DB,$SESS,$TMPL;
$variables = array();
$clubId = $TMPL->fetch_param('club_id');
$sql = "SELECT member_id FROM exp_club_members WHERE (club_id= ".$clubId.") AND (organisation_id < 0)";
$query = $DB->query($sql);
foreach($query->result as $row)
{
$variable_row = array('member_id' => $row['member_id']);
$variables[] = $variable_row;
}
/* What do I do now?*/
return $this->return_data;
}Can anyone point me to an example.
in 1.x, you’ll need to loop through $TMPL->var_single and do string replacements on the EE variables you define. Look at some simple plugins for how they do it, like the twitter timeline plugin. The comments module would also be a good one to study.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.