We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

How do I output variables from module?

Development and Programming

Environ-IT's avatar
Environ-IT
26 posts
15 years ago
Environ-IT's avatar Environ-IT

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.

       
Ingmar's avatar
Ingmar
29,245 posts
15 years ago
Ingmar's avatar Ingmar

Just to let you know I have moved this to the most appropriate forum.

       
Greg Aker's avatar
Greg Aker
6,022 posts
15 years ago
Greg Aker's avatar Greg Aker

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.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.