限制tank_auth在网络时代查看div [英] Constraining tank_auth views to a div on a web age
问题描述
Hi Tank_auth& web Gurus!
Hi Tank_auth & web Gurus!
我有tank_auth使用我的CodeIgniter应用程序。目前,tank_auth的登录/注册视图接管整个屏幕。在我的网站上,我想登录/注册视图占据我定义的div。例如,我希望登录/ pw字段只出现在右上角,而不是占据整个屏幕...你能指出我的方向正确吗? - 我读某处,我不得不以某种方式约束在一个div的视图,但对我的生活我不明白如何!
I have tank_auth working with my CodeIgniter application. Currently, the login/register views of tank_auth take over the entire screen. On my website, I would like the login/register views to occupy a div that I define. For example, I want the login/pw fields to just appear in the top right corner and not take over the whole screen...Can you point me in the right direction? - I read somewhere that I'd have to somehow constrain the view in a div but for the life of me I did not understand how!
很有责任,
Mmiz
推荐答案
为登录创建div。创建登录视图。使用javascript调用视图填充div。
Create div for the login. Create a view for the login. Populate the div with a javascript call to the view.
<?php
//controller
//users.php
class Users {
//...
public function div_login()
{
$this->load->view('div_login_view.php');
}
//...
//------------------------------------------
//view
//div_login_view.php
echo form_open('users/login');
echo form_input('username');
echo form_password('password');
echo form_submit('Login');
echo form_close();
//------------------------------------------
//index page (or whatever page you want the form on)
<div id="login_div"></div>
<script type="text/javascript">
$(document).ready(function(){
var login_form = $.get('/users/div_login');
if (login_form.status === 200){
$('#login_div').html(login_form.responseText)
}else{
alert('There was an error getting the login form.');
}
})
</script>
这篇关于限制tank_auth在网络时代查看div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!