2009-07-13 12 views
4

私はプロジェクトでZend_Service_ReCaptchaを使用していて、ボックスの配色をカスタマイズしたいと思いますが、これを達成するためにどの機能を使用するのか完全に困惑しています。 http://framework.zend.com/manual/en/zend.form.standardElements.html#zend.form.standardElements.captchaは光を当てていないようです。Zendを使用したRecaptchaスタイリング

回答ありがとうございます。

答えて

3

あなたはフォーム要素にcaptcha options経由テーマオプションを渡す必要があります:

何かのように:

$element = new Zend_Form_Element_Captcha('foo', array(
    'label' => "Please verify you're a human", 
    'captcha' => array(
     'captcha' => 'Recaptcha', 
     'timeout' => 300, 
     'theme' => 'red' 
    ), 
)); 
+0

こんにちはDavidさんのスクリプトはこのように完全ではありません。秘密鍵と公開鍵のパラメータを追加する必要があります。よろしく – Michelangelo

8

動作しませんフォーム要素のparamsを経由してこのオプションを設定!このオプション( "テーマ"と "lang")をサービスに渡す必要があります。

public function __construct($publicKey = null, $privateKey = null, 
           $params = null, $options = null, $ip = null) 
{ 
… 

使用法:

$options = array('theme' => 'white', 'lang' => 'ru'); 
$recaptcha = new Zend_Service_ReCaptcha($publicKey, $privateKey, null, $options); 

$this->view->recaptcha = $recaptcha->getHtml(); 

そうでない場合は、あなたのwanna利用形態の要素ならば、あなたは最初のサービスオブジェクトを取得する必要があります

はここZend_Service_ReCaptchaコンストラクタです。そのようなことを試してみてください:

$options = array('theme' => 'white', 'lang' => 'ru'); 
$form->getElement('captcha')->getCaptcha()->getService()->setOptions($options); 
0

あなたがhttp://recaptcha.net/で登録と$ recaptcha_service =新しいZend_Service_ReCaptcha(公共$、プライベート$)は次のようにフォームでそれらを設定するときは、公開鍵と秘密鍵を取得します。

関連する問題