【问题标题】:Opening a bootstrap modal dialog on by loading a view in codeigniter通过在 codeigniter 中加载视图来打开引导模式对话框
【发布时间】:2013-06-10 07:58:50
【问题描述】:

场景: 用户点击Login with Facebook 链接,但实际上用户并未在数据库中注册。网址的代码是:

<a href="<?php echo $this->authlib->fbloginURL(site_url() . 'auth/facebooklogin'); ?>">

auth/facebooklogin()函数中,我正在检查这个条件,如果用户没有注册,我想打开一个注册模式。

facebooklogin() 中用于检查和重定向的代码片段:

if(is_null( $this->authlib->has_account( $fb_id ) ) ) // User has no account
    redirect('/auth/register_modal');

register_modal() 函数只是加载我想要显示的新视图:

function register_modal()
{
    $this->load->view('include/header');
    $this->load->view('auth/register_modal');
    $this->load->view('include/footer');
}

现在出于讨论的目的,我的modal dialog 是:

    <div class="modal hide" id="myModal">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">x</button>
            <h3>Login to MyWebsite.com</h3>
        </div>
        <div class="modal-body">
             <form method="post" action='' name="login_form">
                 <p><input type="text" class="span3" name="eid" id="email" placeholder="Email"></p>
                <p><input type="password" class="span3" name="passwd" placeholder="Password"></p>
                <p><button type="submit" class="btn btn-primary">Sign in</button>
                <a href="#">Forgot Password?</a>
                </p>
             </form>
        </div>
        <div class="modal-footer">
            New To MyWebsite.com?
        <a href="#" class="btn btn-primary">Register</a>
        </div>
</div>

这不起作用。。我想知道我做错了什么?所有相关的引导文件都加载到头文件中。

【问题讨论】:

  • 您的意思是当页面加载正确时您希望模态框自行弹出?
  • 去掉hide,改成show
  • 哦...哈哈哈甚至没有注意到您回答了自己的问题...大声笑
  • 谢谢凯尔。我得出了同样的结论:)

标签: php javascript codeigniter twitter-bootstrap bootstrap-modal


【解决方案1】:

自己找到了解决方案。我只需要在我的模式中更改以下内容:

<div class="modal hide" id="myModal">

<div class="modal show" id="myModal">

即将hide 更改为show。傻我:)

【讨论】:

    【解决方案2】:

    登录

     </diV>
     <div class="modal-body">
    
    
     </div>
     <div class="modal-footer" id="modal-footer" >
    
    
     </div>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-01-25
      • 1970-01-01
      • 2014-01-19
      • 2017-12-14
      • 1970-01-01
      • 1970-01-01
      • 2014-09-06
      相关资源
      最近更新 更多