Привет всем! Нужна помощь знающих людей. Незнаю как совместить скрипт каптчи и контролера при условии что шаблон написан в смарти register.tpl. Капча PHP: <?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * Description of CaptchaController * * @author Елена */ class CaptchaCdController extends Zend_Controller_Action { public function captchaAction() { $session = new Zend_Session_Namespace('captcha'); $configfile = Zend_Registry::get('configfile'); $captcha = new Zend_Captcha_Image(array( 'font' => $configfile->paths->captcha->fonts . '/DejaVuSerif-Bold.ttf', 'imgDir' => $configfile->paths->captcha->img, 'imgUrl' => '../../data/img/captcha/', 'name' => 'captcha', 'width' => 150, 'height' => 80, 'fsize' => 21, 'dotNoiseLevel' => 30, 'lineNoiseLevel'=> 3, 'timeout' => 1000, 'wordlen' => 5 )); $captcha->generate(); $captcha_id = $captcha->getId(); $imgUrl = $captcha->getImgUrl(); $imgSuffix = $captcha->getSuffix(); $this->_helper->viewRenderer->setNoRender(); $this->view->captcha_id = $captcha_id; $this->view->imgUrl = $imgUrl; $this->view->imgSuffix = $imgSuffix; } } ?> нада втулить в контроллер так чтоб проверялись данные введеные в поле с каптчи. Ломал голову но так и не понял как. Тренеруюсь с книги Зерваса, там каптча генерировалась в PEAR, но мне этот подход непонравился, хочу использовать зендовскую каптчу, но как совместить все в кучу я незнаю Вот шаблон {include file='header.tpl'} <form method='post' action='../account/register'> <fieldset> <legend>Создать аккаунт</legend> <div class='error' {if !$form_processor->hasError()} style='display:none'{/if}> Произошла ошибка при заполнении формы, попробуйте заполнить заново </div> <div class='row' id='form_username_container'> <label for='form_username'>Имя пользователя</label> <input type='text' id='form_username' name='username' value='{$form_processor->username}'/> {include file='lib/error.tpl' error=$form_processor->getError('username')} </div> <div class='row' id='form_email_container'> <label for='form_email'>Адрес электронной почты</label> <input type='text' id='form_email' name='email' value='{$form_processor->email}'/> {include file='lib/error.tpl' error=$form_processor->getError('email')} </div> <div class='row' id='form_first_name_container'> <label for='form_first_name'>Фамилия</label> <input type='text' id='form_first_name' name='first_name' value='{$form_processor->first_name}'/> {include file='lib/error.tpl' error=$form_processor->getError('first_name')} </div> <div class='row' id='form_last_name_container'> <label for='form_last_name'>Отчество</label> <input type='text' id='form_last_name' name='last_name' value='{$form_processor->last_name}'/> {include file='lib/error.tpl' error=$form_processor->getError('last_name')} </div> <div class='captcha'> <img src='{$imgUrl}{$captcha_id}{$imgSuffix}'> </div> <div class='row' id='form_captcha_container'> <label for='form_captcha'> Введите выражение</label> <input type='text' id='form_captcha' name='captcha' value=''/> <input type='hidden' name='captcha_submit' value='{$captcha_id}'> {include file='lib/error.tpl' error=$form_processor->getError('captcha')} </div> <div> <input type='submit' value='register'/> </div> <div> <input type='reset'> </div> </fieldset> </form> {include file='footer.tpl'} Контроллер PHP: class AccountController extends Mylib_GlobalControllerAction { public function registerAction() { $request = $this->getRequest(); $form_processor = new Mylib_FormProcessor_UserRegistration($this->db); if ($request->isPost()) { if ($form_processor->process($request)) { $session = new Zend_Session_Namespace('registration'); $session->user_id = $form_processor->user->getId(); $this->_redirect('/account/registercomplete'); } } $this->view->form_processor = $form_processor; } public function registercompleteAction() { $session = new Zend_Session_Namespace('registration'); $user = new Mylib_DatabaseObject_User($this->db); if (!$user->load($session->user_id)) { $this->_forward('register'); return; } $this->view->user = $user; } public function loginAction() { } } ?>