Php 如何在没有jquery完整日历插件的情况下创建日历?
我正在尝试创建一个没有jquery插件和codeigniter的日历。我正在创建一个变量名“conf”。下面是我正在使用的代码Php 如何在没有jquery完整日历插件的情况下创建日历?,php,codeigniter,calendar,Php,Codeigniter,Calendar,我正在尝试创建一个没有jquery插件和codeigniter的日历。我正在创建一个变量名“conf”。下面是我正在使用的代码 <?php class mycal_model extends CI_Model { //public $conf; $conf = null; function mycal_model (){ parent::CI_Model(); $this->conf = array(
<?php
class mycal_model extends CI_Model {
//public $conf;
$conf = null;
function mycal_model (){
parent::CI_Model();
$this->conf = array(
'show_next_prev' => True,
'next_prev_url' => base_url().'index.php/my_calendar/showcal/'
);
$this->conf['cal_tempalte'] = '
{table_open}<table border="0" cellpadding="0" cellspacing="0">{/table_open}
{heading_row_start}<tr>{/heading_row_start}
{heading_previous_cell}<th><a href="{previous_url}"><<</a></th>{/heading_previous_cell}
{heading_title_cell}<th colspan="{colspan}">{heading}</th>{/heading_title_cell}
{heading_next_cell}<th><a href="{next_url}">>></a></th>{/heading_next_cell}
{heading_row_end}</tr>{/heading_row_end}
{week_row_start}<tr>{/week_row_start}
{week_day_cell}<td>{week_day}</td>{/week_day_cell}
{week_row_end}</tr>{/week_row_end}
{cal_row_start}<tr>{/cal_row_start}
{cal_cell_start}<td>{/cal_cell_start}
{cal_cell_content}<a href="{content}">{day}</a>{/cal_cell_content}
{cal_cell_content_today}<div class="highlight"><a href="{content}">{day}</a></div>{/cal_cell_content_today}
{cal_cell_no_content}{day}{/cal_cell_no_content}
{cal_cell_no_content_today}<div class="highlight">{day}</div>{/cal_cell_no_content_today}
{cal_cell_blank} {/cal_cell_blank}
{cal_cell_end}</td>{/cal_cell_end}
{cal_row_end}</tr>{/cal_row_end}
{table_close}</table>{/table_close}
';
}
function generate($year,$month){
$this->load->library('calendar', $conf);
$cal_data = array(
15 => 'foo',
23 => 'bar'
);
return $this->calendar->generate($year,$month,$cal_data);
}
}
如果有人能给我一个这样做的想法,或者为什么我会出现这个错误,这将是一个很大的帮助看起来您使用的是旧版本代码。 这一条应该有效:
<?php
class mycal_model extends CI_Model {
//public $conf;
public $conf = null;
function __construct(){
parent::__construct();
$this->conf = array(
'show_next_prev' => True,
'next_prev_url' => base_url().'index.php/my_calendar/showcal/'
);
$this->conf['cal_tempalte'] = '
{table_open}<table border="0" cellpadding="0" cellspacing="0">{/table_open}
{heading_row_start}<tr>{/heading_row_start}
{heading_previous_cell}<th><a href="{previous_url}"><<</a></th>{/heading_previous_cell}
{heading_title_cell}<th colspan="{colspan}">{heading}</th>{/heading_title_cell}
{heading_next_cell}<th><a href="{next_url}">>></a></th>{/heading_next_cell}
{heading_row_end}</tr>{/heading_row_end}
{week_row_start}<tr>{/week_row_start}
{week_day_cell}<td>{week_day}</td>{/week_day_cell}
{week_row_end}</tr>{/week_row_end}
{cal_row_start}<tr>{/cal_row_start}
{cal_cell_start}<td>{/cal_cell_start}
{cal_cell_content}<a href="{content}">{day}</a>{/cal_cell_content}
{cal_cell_content_today}<div class="highlight"><a href="{content}">{day}</a></div>{/cal_cell_content_today}
{cal_cell_no_content}{day}{/cal_cell_no_content}
{cal_cell_no_content_today}<div class="highlight">{day}</div>{/cal_cell_no_content_today}
{cal_cell_blank} {/cal_cell_blank}
{cal_cell_end}</td>{/cal_cell_end}
{cal_row_end}</tr>{/cal_row_end}
{table_close}</table>{/table_close}
';
}
function generate($year,$month){
$this->load->library('calendar', $conf);
$cal_data = array(
15 => 'foo',
23 => 'bar'
);
return $this->calendar->generate($year,$month,$cal_data);
}
}
你能告诉我parent::CI_Model()的用法吗@尼兰詹。我用它来扩展CI_模型。我想知道如何使用CI_model创建“conf”变量您使用的是什么版本的CI?
<?php
class mycal_model extends CI_Model {
//public $conf;
public $conf = null;
function __construct(){
parent::__construct();
$this->conf = array(
'show_next_prev' => True,
'next_prev_url' => base_url().'index.php/my_calendar/showcal/'
);
$this->conf['cal_tempalte'] = '
{table_open}<table border="0" cellpadding="0" cellspacing="0">{/table_open}
{heading_row_start}<tr>{/heading_row_start}
{heading_previous_cell}<th><a href="{previous_url}"><<</a></th>{/heading_previous_cell}
{heading_title_cell}<th colspan="{colspan}">{heading}</th>{/heading_title_cell}
{heading_next_cell}<th><a href="{next_url}">>></a></th>{/heading_next_cell}
{heading_row_end}</tr>{/heading_row_end}
{week_row_start}<tr>{/week_row_start}
{week_day_cell}<td>{week_day}</td>{/week_day_cell}
{week_row_end}</tr>{/week_row_end}
{cal_row_start}<tr>{/cal_row_start}
{cal_cell_start}<td>{/cal_cell_start}
{cal_cell_content}<a href="{content}">{day}</a>{/cal_cell_content}
{cal_cell_content_today}<div class="highlight"><a href="{content}">{day}</a></div>{/cal_cell_content_today}
{cal_cell_no_content}{day}{/cal_cell_no_content}
{cal_cell_no_content_today}<div class="highlight">{day}</div>{/cal_cell_no_content_today}
{cal_cell_blank} {/cal_cell_blank}
{cal_cell_end}</td>{/cal_cell_end}
{cal_row_end}</tr>{/cal_row_end}
{table_close}</table>{/table_close}
';
}
function generate($year,$month){
$this->load->library('calendar', $conf);
$cal_data = array(
15 => 'foo',
23 => 'bar'
);
return $this->calendar->generate($year,$month,$cal_data);
}
}