在Codeigniter日历中突出显示几天

编程入门 行业动态 更新时间:2024-10-28 04:29:09
本文介绍了在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.

推荐答案

  • 您需要定义要突出显示的天
  • 定义要生成日历的月份
  • 将特殊日期的数组以及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
  • 因此,您需要携带以下内容:

    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日历中突出显示几天

    本文发布于:2023-10-24 06:06:39,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1523133.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:几天   日历   Codeigniter

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!