本文介绍了在Codeigniter日历中突出显示几天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您需要定义要突出显示的天 定义要生成日历的月份 将特殊日期的数组以及Year和Month一起传递给generate()函数。 / li>
You need to define the days that you want to highlight
Define the month you want the calendar to generate
Pass the array of special dates to the generate() function along with the Year and Month
我正在使用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.
推荐答案
因此,您需要携带以下内容:
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日历中突出显示几天
发布评论