nrs jayaram
nrs jayaram

Reputation: 3438

How to display events text in codeigniter calendar?

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?

Upvotes: 3

Views: 4762

Answers (1)

cssBlaster21895
cssBlaster21895

Reputation: 3710

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);

Upvotes: 4

Related Questions