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 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题