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

Plugin cannot fetch parameters

Development and Programming

groovc's avatar
groovc
13 posts
16 years ago
groovc's avatar groovc

After updating my site from 1.5.2 to 1.6.7, one of my custom plugins stopped working. The problem seems to be that it cannot read any of the parameters set in my plugin. I stripped down code to determine what was causing the problem and came up with this:

<?php
$plugin_info = array(
    'pi_name'        => 'Baka Plugin',
    'pi_version'        => '1.0 - 20090324',
    'pi_author'        => 'onore',
    'pi_author_url'        => '',
    'pi_description'    => '',
    'pi_usage'        => baka::usage()
);
    
class baka {
    
    var $return_data = "";
    var $baka_code = "";
    
    function baka() {
    
        global $TMPL;
        
        $var1 = $TMPL->fetch_param('var1'); //REQURIED
        $var2 = $TMPL->fetch_param('var2'); //REQURIED
        
        $baka_code  = $var1.$var2;
                
        $this->return_data = $baka_code;
    } // END function 
        
    function usage() {
    ob_start(); 
    ?>
    REQUIRED PARAMETERS:    
    var1 - part 1
    
    var2 - part 2
    <?php
    $buffer = ob_get_contents();
        
    ob_end_clean(); 
    
    return $buffer;
    } // END        
}
// END CLASS
?>

This plus the EE code of:

{exp:baka var1="no" var2="workie"}

Nothing is returned on my page. I have verified that other non-“tag pair” plugins do not work.

“Tag pair” plugins seem to be working. Am I missing something? Any thoughts on why the parameters are not being fetched properly?

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

Hiya,

Not too sure what you have going wrong on your template as I just pasted your code above into a file called pi.baka.php and then used the same code as you have shown above :

{exp:baka var1="no" var2="workie"}

and I got back noworkie on the template so not sure why you don’t have it working on yours. Are you definitely testing this on the correct template and the same site as the plugin is installed in?

Best wishes,

Mark

       
groovc's avatar
groovc
13 posts
16 years ago
groovc's avatar groovc

Yes. It’s in the correct template. Everything was working prior to by update to the latest version of the EE software.

I’ve tried dozens of plugins and it seems that parameters simply aren’t being passed/read. For instance, I tried the “Word Limiter” plugin. I set the limit to 5 words and typed a 7 word sentence. On display, I see all 7 words.

I’m at a loss of how to troubleshoot this. What would cause EE to not be able to pass parameters?

Anyone else have any thoughts?

       
groovc's avatar
groovc
13 posts
16 years ago
groovc's avatar groovc

Ack. I figured it out. I had an old version of the “Allow EE Code” plug in. Apparently, the version I was using wasn’t compatible with the latest update of the EE software.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen
Ack. I figured it out. I had an old version of the “Allow EE Code” plug in. Apparently, the version I was using wasn’t compatible with the latest update of the EE software.

Excellent news, glad you’ve got it sorted now. Didn’t realise you were using the Allow EE Code plugin though as your first post didn’t mention that anywhere 😉

Anyway hope everything else goes well for you.

Best wishes,

Mark

       

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.