2010-08-26 90 views
0

我正在使用jQTouch框架爲iPhone開發一個Web應用程序。我發現一個類似的例子,我要怎麼設置我的登錄頁面在:jQTouch和PHP登錄表格

http://www.golen.net/blog/2010/05/29/jqtouch-ajax-php-login-form/

而且已經下載了示例PHP文件: http://www.golen.net/blog/wp-content/uploads/2010/05/jqtouch.zip

在視頻3,伴隨着這個博客就說明除非您單擊登錄鏈接,否則登錄表單不會顯示。然而,我已經下載了這些文件,並將它們上傳到了我的兩臺服務器,無論我是否登錄,登錄表單總是顯示出來。據我所知,可下載的php文件與視頻中的內容相同,但我無法阻止登錄表單始終顯示。

任何人有任何想法。這裏的index.php頁面,其中包括登錄表單,以及:

<?php 

$的loggedIn =(isset($ _ COOKIE [ '的loggedIn'])& & $ _COOKIE [ '的loggedIn'] == '真') ?真假; >

<title>jQTouch &beta;</title> 
    <style type="text/css" media="screen">@import "jqtouch/jqtouch.css";</style> 
    <style type="text/css" media="screen">@import "themes/jqt/theme.css";</style> 
    <script src="jqtouch/jquery-1.4.2.min.js" type="text/javascript" charset="utf-8"></script> 
    <script src="jqtouch/jqtouch.js" type="application/x-javascript" charset="utf-8"></script> 
    <script type="text/javascript" charset="utf-8"> 
     var jQT = new $.jQTouch({ 
      icon: 'jqtouch.png', 
      addGlossToIcon: false, 
      startupScreen: 'jqt_startup.png', 
      statusBar: 'black', 
      preloadImages: [ 
       'themes/jqt/img/back_button.png', 
       'themes/jqt/img/back_button_clicked.png', 
       'themes/jqt/img/button_clicked.png', 
       'themes/jqt/img/grayButton.png', 
       'themes/jqt/img/whiteButton.png', 
       'themes/jqt/img/loading.gif' 
       ] 
     }); 
     // Some sample Javascript functions: 
     $(function(){ 
     }); 
    </script> 
</head> 
<body> 
    <div id="jqt"> 
     <div id="home"> 
      <div class="toolbar"> 
       <h1>Welcome</h1> 
       <a class="back" href="#home">Home</a> 
      </div> 
      <?php if (!$loggedIn) {?> 
      <ul class="rounded"> 
       <li class="forward"><a href="#login">Log In</a></li> 
      </ul> 
      <?php } else { ?> 
      <ul class="rounded"> 
       <li class="forward"><a href="doLogoff.php" rel="external">Log off</a></li> 
      </ul> 
      <?php } ?> 
     </div> 
     <form id="login" action="doLogin.php" method="POST" class="form"> 
      <div class="toolbar"> 
       <h1>Login</h1> 
       <a class="back" href="#">Back</a> 
      </div> 
      <ul class="rounded"> 
       <li><input type="text" name="username" value="" placeholder="Username" /></li> 
       <li><input type="password" name="password" value="" placeholder="Password" /></li> 
      </ul> 
      <a style="margin:0 10px;color:rgba(0,0,0,.9)" href="#" class="submit whiteButton">Submit</a> 
     </form> 
    </div> 
</body> 

回答

1

,你只需要修改代碼有點...刪除JQT DIV,並放入一個div id'ed「登錄......這樣?

<body> 

     <div id="home"> 
      <div class="toolbar"> 
       <h1>Welcome</h1> 
       <a class="back" href="#home">Home</a> 
      </div> 
      <?php if (!$loggedIn) {?> 
      <ul class="rounded"> 
       <li class="forward"><a href="#login">Log In</a></li> 
      </ul> 
      <?php } else { ?> 
      <ul class="rounded"> 
       <li class="forward"><a href="doLogoff.php" rel="external">Log off</a></li> 
      </ul> 
      <?php } ?> 
     </div> 

    <div id="login"> 
     <form id="login" action="doLogin.php" method="POST" class="form"> 
      <div class="toolbar"> 
       <h1>Login</h1> 
       <a class="back" href="#">Back</a> 
      </div> 
      <ul class="rounded"> 
       <li><input type="text" name="username" value="" placeholder="Username" /></li> 
       <li><input type="password" name="password" value="" placeholder="Password" /></li> 
      </ul> 
      <a style="margin:0 10px;color:rgba(0,0,0,.9)" href="#" class="submit whiteButton">Submit</a> 
     </form> 
    </div> 

</body> 

希望幫助你:-)