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

如何在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?

  • 写回答

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);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了