|
本帖最后由 phproot 于 2012-1-16 14:39 编辑
PHP复制代码
public function ajax_message ($title = 'Info', $message = '', $status = 'error', $uri = '') {
if (substr($message, 0, 5) == 'lang:')
{
$line = substr($message, 5);
if (FALSE === ($message = lang ($line)))
{
return $line;
}
}
$message_array = array(
'title' => (string ) $title,
'message' => (string ) $message,
'status' => (string ) $status,
'uri' => (string ) $uri
);
$_ajax_message_views = $this->load->view('debug/javascript/ajax_message_views', $message_array, TRUE);
$this->load->library('javascript');
$this->javascript->ready($_ajax_message_views);
$this->javascript->compile('ajax_message');
$this->javascript->clear_compile();
}
[size =14px ] 复制代码
PHP复制代码 //javascript/ajax_message_views
<?php if (empty($uri)) :?>
$.messager.alert(" <?=$title;?>", " <?=$message;?>", " <?=$status;?>");
<?php else : ?>
location.href = <?=$uri;?>;
<?php endif?>
复制代码
PHP复制代码 $this->message->ajax_message('标题','内容','状态','url可选'); 复制代码PHP复制代码 <?=$ajax_message;?> //加入到header的视图层里。 复制代码 如果使用url自动跳转功能,则前面的为空即可。
|
评分
-
查看全部评分
|