Yii Framework Forum: Customizing Captchas - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Customizing Captchas ...based on theme Rate Topic: -----

#1 User is offline   alexb 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 04-May 10

Posted 20 July 2010 - 03:14 PM

Hi guys,

I'm trying to customize the appearance of my captcha image based on the theme used. In other words, depending on the theme, the captcha would appear differently (ex: different background color, etc). If it wasn't for the themes, I could achieve this by simply changing CCaptchaAction's property inside the controller's actions method, such as:

	public function actions()
	{
		return array(
			'captcha'=>array(
				'class'=>'CCaptchaAction',
				'backColor'=>'#000000', // black
			),

		);
	}


...but since I'm using themes, it would be much more convenient and efficient to change all that in the view that renders the captcha image. Is there a way to do that?

Thanks,
Alex
0

#2 User is offline   alexb 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 04-May 10

Posted 26 July 2010 - 09:05 AM

sorry for the bump, but I was wondering if somebody could help me out about this issue...I'd really appreciate it.
0

#3 User is offline   mbi 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 608
  • Joined: 08-May 09

Posted 26 July 2010 - 09:35 AM

you can load a theme-config, however, based on your current theme string

public function actions()
{
    return array(
        'captcha'=> include ($path.to.themeConfig)
    );
}

0

#4 User is offline   alexb 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 04-May 10

Posted 26 July 2010 - 10:37 AM

View Postmbi, on 26 July 2010 - 09:35 AM, said:

you can load a theme-config, however, based on your current theme string

public function actions()
{
    return array(
        'captcha'=> include ($path.to.themeConfig)
    );
}



thanks a lot mbi. I got it working by following your advice :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users