I'm trying to create a class in EE, but for some reason it just won't work for me. I've even went as far as making it as easy as possible, but I always get:

The following tag has a syntax error:


Please correct the syntax in your template.

Here's the simple class:

class My_class_name {

    public $return_data;

    public function __construct(){
        $this->EE =& get_instance();

    public static function usage(){
        Coming Soon, this is just filler for now.
        $buffer = ob_get_contents();
        return $buffer;

    public function testfunction(){
        $this->return_data = ee()->TMPL->tagdata;


and usage:

  • can u see your plugin in CP plugin list ?
    – Max Lazar
    Sep 30, 2014 at 5:18
  • BTW: "$this->EE =& get_instance();" is redundant now as you're using the super global ee() Sep 30, 2014 at 7:47

1 Answer 1


Your plugin class method needs to return the (parsed) tagdata instead of setting the $this->return_data property. The latter is only needed if the class constructor is used for template output. So:

public function testfunction()
    return ee()->TMPL->tagdata;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.