在Codeigniter日历中突出显示几天 [英] Highlight some days in codeigniter calendar

查看:43
本文介绍了在Codeigniter日历中突出显示几天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用codeigniter日历库来生成日历。
为此,我使用了以下代码:

I am using codeigniter calendar library for generating a calendar. For that I used this code :

$this->load->library('calendar');
$myarray= array('2014-09-05','2014-09-12','2014-09-15','2014-09-22');

$data['docs']   =   $this->calendar->generate();
$this->load->view('mycal',$data);

我需要在 $ myarray 具有红色背景色。

I need to display the values in $myarray with a red background color.

推荐答案


  1. 您需要定义要突出显示的

  2. 定义要生成日历的月份

  3. 将特殊日期的数组以及Year和Month一起传递给generate()函数。 / li>
  1. You need to define the days that you want to highlight
  2. Define the month you want the calendar to generate
  3. Pass the array of special dates to the generate() function along with the Year and Month

因此,您需要携带以下内容:

So you need to bring the followings:

在控制器中

$this->load->library('calendar');
$myarray= array(
    5=>'2014-09-05', # or you can set as: 5=>'SomeLink'
    12=>'2014-09-12',
    15=>'2014-09-15',
    22=>'2014-09-22'
);

$data['docs'] = $this->calendar->generate(2014,9, $myarray);
$this->load->view('mycal',$data);

视图中

<style>
#calendar a{
    background: red;
    padding:2px;
}
</style>
<div id="calendar">
    <?php echo $docs; ?>
</div>

这篇关于在Codeigniter日历中突出显示几天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆