【问题标题】:How to display a reminder window on any page of application如何在应用程序的任何页面上显示提醒窗口
【发布时间】:2013-03-20 12:22:03
【问题描述】:
在我的网络应用程序中,用户将能够为即将到来的任务和事件设置提醒。我正在使用带有模型视图控制器基础的 CodeIgniter (PHP) 开发应用程序。
我设置了提醒所需的数据库表。我将使用作业服务器运行我的提醒控制器。我的困惑从这里开始。该控制器将调用作为弹出窗口的视图文件。但我需要在用户所在的页面上显示此提醒弹出窗口。如何在另一个上显示视图?或者你会推荐什么?
【问题讨论】:
标签:
php
codeigniter
reminders
【解决方案1】:
我相信您指的是模态窗口。如果是这种情况,您将需要使用 JS/jQuery 或/和 CSS。你可以谷歌它并找到很多关于模态的教程。如果不是这样,请扩展您的问题。
【解决方案2】:
您应该创建另一个 PHP 文件,并将该文件包含在您想要提醒窗口的每个文件中。
- 在通用文件中应该有一些类似“setInterval”的函数
然后通过js或jquery调用modal。
2.也许有帮助(两者都在同一个文件中)
JS
setInterval(tick, 30000); function tick() {
//get the mins of the current time
var mins = new Date().getMinutes();
if(mins == "18"|| mins == "19" || mins == "20"||mins == "21" || mins == "22" || mins == "23"){
$('#reminder').modal('show');
beep();
}
}
HTML(引导模式)
<div id="reminder" class="modal fade bd-example-modal-lg" >
<div class="modal-dialog modal-lg" style=" margin-top: 150px; ">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
</button>
<h4 class="modal-title" style="color:red;">
Reminder
</h4>
</div>
<div class="modal-body" id="reminder_body">
<script>
load_reminder();
</script>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary" data-dismiss="modal" >
Ok
</button>
</div>