形成在cakephp的标题 [英] Form at header of cakephp

查看:74
本文介绍了形成在cakephp的标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在cakephp网站的标题处创建一个登录表单。标题表格在每页都可见。



 <?php  
echo $ this-> Form-> create(' User',array(' id' => < span class =code-string>' loginform'' type' => ' post'' name' => ' btnLoginHeader'' action' => ' login')); ?>
< table >
< tr >
< td > <? php echo $ this-> Form->按钮(' 登录',数组(' type' => ' 提交'' class' => ' btnLogin'' name' => ' btnLoginHeader')); ?> < / td < span class =code-keyword>>
< td > <? php echo $ this-> Form->输入(' 用户名',数组(' label' => false,' name' => ' email' 占位符' => ' 用户名
' required' => ' required')); ?> < / td < span class =code-keyword>>
< td > <? php echo $ this-> Form->输入(' password',array(' label' => false,' name' => ' password' 占位符' => ' 密码'' required' => ' required')); ?> < / td < span class =code-keyword>>
< / tr >
< / table >
<? php echo $ this-> Form-> end(); ?>













在cakephp中,表单找到控制器函数,它在表单的action中提到,而控制器中的操作用相同的方式调用视图命名为功能。我的情况不同,我不需要查看。我在控制器的登录功能中设置了会话。如何在标题处使用表单?

解决方案

this-> Form-> create('' 用户',数组(' id' => ' loginform'' type' => ' post'' name' => ' btnLoginHeader'' action' => ; ' login')); ?>
< table >
< tr >
< td > <? php echo


this-> Form->按钮(' 登录',数组(' type' => ' submit'' class ' => ' btnLogin' ' name' => ' btnLoginHeader )); ?> < / td < span class =code-keyword>>
< td > <? php echo


this-> Form-> input(' username',array(' label' => false, ' name' => ' email '' 占位符' => ' 用户名'
' 要求' => ' required')); ?> < / td < span class =code-keyword>>
< td > <? php echo

A login form is made at header of cakephp site. Form at header is visible at every page.

<?php
	echo $this->Form->create('User', array('id' => 'loginform', 'type' => 'post','name'=>'btnLoginHeader','action' =>'login')); ?>
	<table>
	<tr>			    
           <td><?php echo $this->Form->button('Login', array('type'=>'submit', 'class' => 'btnLogin', 'name'=>'btnLoginHeader')); ?></td>
	    <td><?php echo $this->Form->input('username',   array('label'=>false,'name'=>'email','placeholder'=>'Username',          
'required' => 'required')); ?></td>
	     <td><?php echo $this->Form->input('password',   array('label'=>false,'name'=>'password','placeholder'=>'Password','required' => 'required')); ?></td>
	</tr>
	</table>
	<?php echo $this->Form->end(); ?>







In cakephp, form find controller function which is mentioned in 'action' of form, and that action in controller calls the view with the same name as function. My situation is different that I don't need view. And I have set session in login function of controller. How to work with form at header ?

解决方案

this->Form->create('User', array('id' => 'loginform', 'type' => 'post','name'=>'btnLoginHeader','action' =>'login')); ?> <table> <tr> <td><?php echo


this->Form->button('Login', array('type'=>'submit', 'class' => 'btnLogin', 'name'=>'btnLoginHeader')); ?></td> <td><?php echo


this->Form->input('username', array('label'=>false,'name'=>'email','placeholder'=>'Username', 'required' => 'required')); ?></td> <td><?php echo


这篇关于形成在cakephp的标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆