Bonjour,

Ayant déja lu et relu la documentation, cherché et recherché je n'arrive pas à comprendre le comportement du framework.

Donc j'ai un layout qui s'affiche correctement et je veux faire des opération distinctes sur un formulaire d'authentification dans une zone et un formulaire d'inscription dans ma zone principale de contenu.

Voici mon layout :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 
<?php echo $this->doctype(); ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <?php echo $this->headTitle(); ?>
	<meta name="description" content="description content" />
	<meta name="keywords" content="keywords" />
	<meta name="author" content="author" />
	<meta charset="UTF-8" />
	<!--[if IE]>
	<script src="/scripts/html5-ie.js"></script>
	<link href="/css/themes/colorpaper/ie.css" media="screen" rel="stylesheet" type="text/css" />
	<![endif]--> 
	 <?php echo $this->headLink()->appendStylesheet('/css/themes/colorpaper/style.css')
								 ->appendStylesheet('/css/themes/colorpaper/reset-min.css');?>
 
</head>
<body>
<div id="bgRepeatBottom">
			<div id="bgTop">
				<div id="bgBottom">
					<div id="content">
					<header>
						<nav>
							<a href="<?php echo $this->url(array('controller'=>'index'),'default',true) ?>" title="Accueil" >Accueil</a>
							<a href="<?php echo $this->url(array('controller'=>'concept'),'default',true) ?>" title="Concept du site" >Concept du site</a>
							<a href="<?php echo $this->url(array('controller'=>'rss'),'default',true) ?>" title="RSS" >RSS</a>
							<a href="<?php echo $this->url(array('controller'=>'contact'),'default',true) ?>" title="Contact">Contact</a>
						</nav>
					</header>	
						<div id="brdTopContent"></div>
						<div id="page">
							<div id="leftContent">
								<section id="searchengine">
									 <h1><?php echo $this->escape($this->title); ?></h1>
									<?php echo $this->layout()->content;?>
								</section>	
								<div id="backgroundBottomLeftContent"></div>
								<section id="news">
 
								</section>
							</div>
							<div id="rightContent">
								<section id="log">
									<h1> Authentification </h1>
									<?php echo $this->action('log','login'); ?>	
								</section>	
								<section id="statistics">
 
								</section>
								<section id="ranking">		
 
								</section>
							</div>
							<div class="spacer"></div>
						</div>
						<footer>
							<nav>
 
							</nav>
						</footer>
					</div>
				</div>
			</div>
		</div>
</body>
</html>
Voici mon controller Login

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 
<?php
 
class LoginController extends Zend_Controller_Action
{
 
    public function init()
    {
 
    }
 
    public function indexAction()
    {
 
    }
 
	public function logAction()
    {
		$formLogin = new Form_Login();
		$this->view->loginForm = $formLogin;
		$this->render('log');
		if($this->getRequest()->isPost()){
			$formDataLogin = $this->getRequest()->getPost();
				if ($formLogin->isValid($formDataLogin)) {
					Zend_Debug::dump('ici');
				}else{
					$formLogin->populate($formDataLogin);
				}
		}
 
 
    }
 
 
 
 
}
voici la vue login.phtml


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
<?php echo $this->loginForm; ?>
voici le form login.php associé
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 
<?php
	class Form_Login extends Zend_Form
	{
		public function __construct($options = null)
		{
			parent::__construct($options);
 
			$this->setName('login');
			$this->setAction('/login/log');
 
			$email = new Zend_Form_Element_Text("emailLog",array('size' => 25));		
			$email ->setLabel('E-mail *')
				   ->setRequired(true)
				   ->addFilter('StringTrim')
				   ->addFilter('StripTags')
				   ->addValidator('NotEmpty', true , array('messages' => array('isEmpty' => 'Vide')))
				   ->addValidator('EmailAddress');
 
 
			$email->addDecorator(new My_Form_Decorator_Html(array('html' => "<div class='spacer'></div>",'placement' => 'append')));
 
			$password = new Zend_Form_Element_Password("passwordLog", array('size' => 25));
			$password ->setLabel('Mot de passe *')
					  ->setRequired(true)
					  ->addFilter('StringTrim')
					  ->addValidator('NotEmpty', true , array('messages' => array('isEmpty' => 'Vide')));
			$password->addDecorator(new My_Form_Decorator_Html(array('html' => "<div class='spacer'></div>",'placement' => 'append')));	
 
 
			$valider = new Zend_Form_Element_Submit('valider');
			$valider->addDecorator(new My_Form_Decorator_Html(array('html' => "<a title='Inscription' href='/users/ajouter' id='inscription-link'>Inscription</a>",'placement' => 'append')));	
			$valider->setAttrib('id', 'boutonValider')
					->removeDecorator('DtDdWrapper');	
 
			$this->addElements(array($email,$password,$valider));
 
 
 
 
		}
 
	}
Donc mon formulaire d'authentification s'affiche correctement en haut à droite dans mon layout dans la <section id="log"> .

Par contre quand je valide ce formulaire d'authentification :
-Le formulaire vide s'affiche dans la section <section id="searchengine"> à la place du $this->layout()->content; au lieu de rester dans la section dans laquelle j'ai mon formulaire <section id="log"> ?
-Les messages liés aux validateurs ->addValidator('NotEmpty', true , array('messages' => array('isEmpty' => 'Vide'))) ne s'affiche pas même dans cette mauvaise section ?

Voilà je ne comprends pas pourquoi le framework agit comme ça ?
Il doit y avoir quelque chose qui m'échappe ...

En vous remerçiant.