0

ユーザーが初めてアプリにログインするときに、一般的な情報を含む jQuery ダイアログを表示したいと考えています。

ユーザーがログインしているかどうかを確認するには、mySQL データベースの last_login フィールドを確認します。空の場合、ユーザーはまだログインしていません。

jQueryダイアログの設定方法も知っています。

しかし、jQuery と mySQL を一緒に使用できるとは思わないので、この問題を解決するために他の人が何を使用したかを知りたいです。SOに関する他の質問のいくつかを見てきました。初回ログインとポップアップを一緒にするものは見つかりませんでした。

フレームワークに Codeigniter を使用しています。

4

3 に答える 3

3

When you're validating login, just pass a parameter to the page saying that it's the first login. So validate as normal, but just tell the page you get redirected to that it is the user's first time (via that mysql column).

The page you view when you successfully login will check to see if that parameter is passed and, if it is, will pop the modal.

Look here to read about modals: http://jqueryui.com/demos/dialog/. You can set the variable in session, as mentioned, or you could pass it as a querystring parameter. You can use that variable to determine whether or not to fire the modal.

于 2012-05-03T02:22:10.907 に答える
0

codeigniter は php (タグ付けされていない) だと思うので、スクリプトを php if ステートメント内にポップアップするダイアログを配置するだけです:

<?php if (fFirstTime) { ?>
<script>
  $("#dialogdiv").dialog({...options...});
</script>
<?php } ?>

エラーがあると確信しているため、これを疑似コードとして扱いますが、アイデアは得られます。fFirstTime は、codeigniter の db レイヤー (モデル) から取得されます。

于 2012-05-03T02:33:45.917 に答える
0

セッションにフラグを設定し、セッションが作成されたらそれを識別子として使用することをお勧めします。

JQuery を使用してデータベースと対話する方法は、 MongoDBのような永続ストレージ NOSQL データベースを使用することです。

于 2012-05-03T02:24:31.830 に答える