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

报告相同问题?

悬赏问题

  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥15 键盘指令混乱情况下的启动盘系统重装