Bootstrap与烤面包机配合不好
Bootstrap not working well with toastr
我在php函数中使用了它,现在我在php中遇到了一个错误,我认为这是te问题,(SyntaxError:丢失;在语句行133之前(我的php函数是:
<?php
function VISION_TO_REPORT_MESSAGES($report_tag = "test", $subject_parameters = '', $message_parameters = '', $output=true, $lang = '')
{
// action report messages templates ...
$report_tag = strtolower(trim($report_tag));
if (strlen($report_tag))
{
$report_message = array();
$db = new clsDBcms();
$SQL = " SELECT * FROM report_messages WHERE report_tag= " . $db->ToSQL($report_tag, ccsText) . " LIMIT 1 ";
$db->query($SQL);
$Result = $db->next_record();
if ($Result)
{
$report_message['lang'] = $db->f("lang");
if(function_exists("VISION_TO_TRANSLATE"))
{
$report_message['subject'] = VISION_TO_MULTI_CONTENT($db->f("subject"),$lang);
$report_message['message'] = VISION_TO_MULTI_CONTENT($db->f("message"),$lang);
}
else
{
$report_message['subject'] = $db->f("subject");
$report_message['message'] = $db->f("message");
}
$report_message['css'] = $db->f("css");
$report_message['redirect_to'] = $db->f("redirect_to");
$report_message['type'] = $db->f("type");
if(!empty($subject_parameters))
{
while (list($this_tag,$value) = each($subject_parameters))
$report_message['subject'] = preg_replace("/".$this_tag."/i", $value, $report_message['subject']);
}
if(!empty($message_parameters))
{
while (list($this_tag,$value) = each($message_parameters))
$report_message['message'] = preg_replace("/".$this_tag."/i", $value, $report_message['message']);
}
}
$db->close();
if($output == true && isset($report_message['message']))
//$output = '<script type="text/javascript">';
$output = 'toastr.options ={
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": true,
"positionClass": "toast-top-center",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
}';
$output .= 'toastr.' . $report_message['css'] . "('" . str_replace("'", "'''", htmlentities($report_message['message'])) . "'" . (isset($report_message['subject']) ? ", '" . str_replace("'", "'''", htmlentities($report_message['subject'])) . "'" : null) . ');';
return $output;
}
}
?>
我的html中的第133行是:
toast。success("用户记录已成功更新。","记录已更新。"(;
在我的页面标题中,我使用:
<link href="//cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.2/toastr.css" rel="stylesheet"/>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.js"></script>
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.css" rel="stylesheet"/>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.js"></script>
在toast中添加引导程序时,我没有看到任何复杂情况,但您的代码确实存在一些问题:
- 首先,如果你要共享代码,请尝试包含必要的库来实际运行它。你可以使用下面的例子,或者toast标签上的说明
toastr options = {
应该有一个周期来访问toastr
对象上的options
属性,如下所示:toastr.options = {
toastr-success('The...
也是如此,它应该使用句点而不是连字符来调用成功方法,如下所示:toastr.success('The...
- 如果自动将
<strong>
转义为<strong>
,则不可能将其呈现为html它已经逃走了所以你需要像普通html一样包含括号,然后告诉toast不要像这样转义:toastr.options.escapeHtml = false;
这是Stack Snippets中的一个工作演示-请在提问时将其用作未来的模板,这样人们就可以看到代码中的实际问题所在。
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": true,
"positionClass": "toast-top-center",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
"escapeHtml": false
}
toastr.success('The <strong>User</strong> record has been successfully updated.', 'Record Updated.');
<link href="//cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.2/toastr.css" rel="stylesheet"/>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.js"></script>
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.css" rel="stylesheet"/>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.js"></script>
相关文章:
- 如何计算二十面体的法线
- 角度烤面包机:发送到烤面包机上隐藏的路径
- ReacJS与猴面包树,如何在卸载组件后释放光标
- 如何使用 Angularjs 显示面包屑
- 从矩形生成凸面
- 控制立方体或其他几何体的每个面,分为三.js
- 如何使用javascript创建面包屑
- 什么是面框“钩子”
- 轻扫面漆侧边菜单
- 在BufferGeometry上识别光线投射交点的面
- 纸烤面包而不是解雇事件
- 烤面包机-选项问题
- 任何控制器angularjs中的火灾通知烤面包机
- AngularJS-烤面包机在控制器中不工作
- Bootstrap与烤面包机配合不好
- 使用选项时,烤面包机不会着火
- 烤面包信息没有出现在我的屏幕上
- 仅在登录成功时显示烤面包机通知
- Angularjs的烤面包机没有显示
- 烤面包机通知未显示