dregvw1801
2015-08-21 07:10
浏览 107
已采纳

如何在codeigniter日历中显示事件文本?

I am using Codeigniter 3.0 Calendar Library, I am not getting event text in my CI calendar, Instead of displaying event text it shows link on the number.

Sample Codeigniter Code:

class Welcome extends CI_Controller {

    function index()
    {
        $this->display($year = null, $month = null);
    }
     public function display($year = null, $month = null)
    {
            $config = array(
            'show_next_prev' => TRUE,
            'show_other_days' => TRUE,
            'next_prev_url' => site_url('welcome/display')
            );
            $events = array(
                1 =>'test1',
                2 =>'test2'
            );
            $this->load->library('calendar', $config);
            echo $data['calendar'] = $this->calendar->generate($year, $month, $events);

    }
}

Sample Calendar image (output of above code) :

enter image description here

In the above calender you can see 1st and 2nd days are linked and not displaying events text like test1 and test2 in the calendar, how can i rectify this?

图片转代码服务由CSDN问答提供 功能建议

我正在使用Codeigniter 3.0日历库,我没有在CI日历中获取事件文本,而不是显示事件文本 它显示了数字上的链接。

示例Codeigniter代码:

 类欢迎扩展CI_Controller {
 
函数索引()\  n {
 $ this-> display($ year = null,$ month = null); 
} 
公共函数显示($ year = null,$ month = null)
 {
 $ config = array  (
'show_next_prev'=> TRUE,
'show_other_days'=> TRUE,
'nene_prev_url'=> site_url('welcome / display')
); 
 $ events = array(
  1 =>'test1',
 2 =>'test2'
); 
 $ this-> load-> library('calendar',$ config); 
 echo $ data ['calendar  '] = $ this-> calendar-> generate($ year,$ month,$ events); 
 
} 
} 
   
 
 

示例 日历图像(上述代码的输出):

在上述日历中,您可以看到第1天和第2天已关联且未显示事件文本 日历中的 test1 test2 ,我该如何纠正?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • donglou8371 2015-09-08 13:20
    已采纳

    You can modify any piece of calendar template, change content and just provide data. For example you can provide title attribute inside a element, to use it as simple tooltip on hover, or adjust html to provide more sophisticated ui interaction. Take a look:

    $prefs['template'] = array(
            'cal_cell_content'       => '{content}',
            'cal_cell_content_today' => '<div class="highlight">{content}</div>'
        );
        $this->load->library('calendar', $prefs);
        $data = array(
            3  => '<a title="my event" href="http://example.com/news/article/2006/03/">My event</a>',
            7  => '<a title="conference" href="http://example.com/news/article/2006/07/">Conference</a>',
            13 => '<a title="lecture" href="http://example.com/news/article/2006/13/">Lecture</a>',
            26 => '<a title="city walk" href="http://example.com/news/article/2006/26/">City walk</a>'
        );
    
    
        echo $this->calendar->generate(2015, 6, $data);
    
    点赞 评论

相关推荐 更多相似问题