dougu8742 2016-10-24 03:37
浏览 23
已采纳

CodeIgniter日历首选项模板不起作用

Here is my $prefs.

   $prefs = array(
            'month_type' => 'long',
            'day_type' => 'short',
            'show_next_prev' => true,
            'next_prev_url' => base_url('calendar/index'),
            'show_other_days' => true,

        );
        $prefs['template'] = array(
            'table_open' => "<table class='calendar'>",
            'cal_cell_start' => '<td class="day">',
            'cal_cell_start_today' => '<td class="today">'
        );

Then here is the output when i run this code.

 echo '<pre>';
 print_r($prefs);
 echo '</pre>';die();


Array
(
    [month_type] => long
    [day_type] => short
    [show_next_prev] => 1
    [next_prev_url] => http://localhost/MeemoStore/calendar/index
    [show_other_days] => 1
    [template] => Array
        (
            [table_open] => 
            [cal_cell_start] => 
[cal_cell_start_today] =>   ) )

I've configured a calendar before and i had no problem with it. Can anyone help me out?



[EDIT]

  $this->load->library('calendar', $prefs);
  echo $this->calendar->generate($year, $month); die();


OUTPUT HTML:

<table border="0" cellpadding="4" cellspacing="0">

<tr>
<th colspan="7">October&nbsp;2016</th>

</tr>

<tr>
<td>Su</td><td>Mo</td><td>Tu</td><td>We</td><td>Th</td><td>Fr</td><td>Sa</td>
</tr>

<tr>
<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>1</td>
</tr>

<tr>
<td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td>
</tr>

<tr>
<td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td><td>15</td>
</tr>

<tr>
<td>16</td><td>17</td><td>18</td><td>19</td><td>20</td><td>21</td><td>22</td>
</tr>

<tr>
<td>23</td><td><strong>24</strong></td><td>25</td><td>26</td><td>27</td><td>28</td><td>29</td>
</tr>

<tr>
<td>30</td><td>31</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>
</tr>

</table>

The template didn't affect the table.

  • 写回答

2条回答 默认 最新

  • donglian8407 2016-10-26 10:23
    关注

    The calendar library was on autoload file, i removed it from there and it is now working. Sorry for the post!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?