Results 1 to 4 of 4

Thread: Accessing a method in Stylesheets Class

  1. #1
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Accessing a method in Stylesheets Class

    Im trying to access the protected function compileColor() in the Stylesheets class [class StyleSheets extends Backend] - from the compile() method within a class I've created for a module [class ModuleSelectnav extends Module].
    I keep getting cannot load/cannot instantiate errors.

    Can someone tell me how i can call this?

  2. #2
    User
    Join Date
    06-19-09.
    Posts
    328

    Default Re: Accessing a method in Stylesheets Class

    Quote Originally Posted by ramjet
    Im trying to access the protected function compileColor() in the Stylesheets class [class StyleSheets extends Backend] - from the compile() method within a class I've created for a module [class ModuleSelectnav extends Module].
    I keep getting cannot load/cannot instantiate errors.

    Can someone tell me how i can call this?
    just to give you a starting point (not tested and you have to edit it to add missing parameters)

    Code:
    class MyStyleSheets extends Stylesheets {
    
         public function compileColor() {
                  return parent::compileColor();
         }
    
    }

    then in you module just create an instance of MyStyleSheets instead of Stylesheets


    hope this helps
    Consulenza Contao CMS https://www.intco.it

  3. #3
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Accessing a method in Stylesheets Class

    Awesome - thanks a heap ga.n
    This works a treat.

    Just to show others -
    Code:
    class SelectnavStyleSheets extends StyleSheets
    {
    
         public function compileColor($color, $blnWriteToFile=false, $vars=array()) {
                  return parent::compileColor($color, $blnWriteToFile=false, $vars=array());
         }	
    }
    and

    Code:
    $thanksGan = new SelectnavStyleSheets;	
    $mm_bcolor1 = $thanksGan->compileColor(deserialize($this->mm_bcolor1));//Background Color #
    I'm so appreciative I have named a variable in honour of you! :D

  4. #4
    User
    Join Date
    06-19-09.
    Posts
    328

    Default Re: Accessing a method in Stylesheets Class

    :lol:
    Consulenza Contao CMS https://www.intco.it

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •