dtgr6303 2015-10-08 01:11
浏览 23

代码点火器日历| 在模板外插入{day}

This is basically the entire code. I'm trying to display in the calendar day if there are available time slots to book an appointment. There are 3 available per day. It checks the number of used time slots and uses the switch statement to echo how many are left.

$count = $this->cal->countByDate($this->uri->segment(2) . "-" . $this->uri->segment(3) . "-" . "22");
    $testswitch = 0;
    switch ($count) {
        case '0':
            $testswitch = 'Three Available Time Slots <br><br><a href="" class="btn btn-default btn-xs"><i class="fa fa-calendar"></i> Book Appointment</a>';
            break;
        case '1':
            $testswitch = 'Two Available Time Slots <br><br><a href="" class="btn btn-default btn-xs"><i class="fa fa-calendar"></i> Book Appointment</a>';
            break;
        case '2':
            $testswitch = 'One Available Time Slot <br><br><a href="" class="btn btn-default btn-xs"><i class="fa fa-calendar"></i> Book Appointment</a>';
            break;
        case '3':
            $testswitch = 'No Available Time Slots';
            break;

        default:
            $testswitch = 'Something Is Broken';
            break;
    }

    echo "<pre>";
    print_r ($count);
    echo "</pre>";
    $yolo = true;
    //PREFS
    $prefs = array(
    'start_day'    => 'monday',
    'month_type'   => 'long',
    'day_type'     => 'long',
    'show_next_prev'  => TRUE,
    'next_prev_url'   => base_url('schedule/'),
    );


$prefs['template'] = '
{table_open}<table class="calendar">{/table_open}
{week_day_cell}<th class="day_header">{week_day}</th>{/week_day_cell}
{cal_cell_content}<span class="day_listing"><a href="{content}">{day}</a></span>&nbsp; ' . 
"{$testswitch}"
 . '&nbsp;{/cal_cell_content}
{cal_cell_content_today}<div class="today"><span class="day_listing"><a href="{content}">{day}</a></span>&nbsp; {content}</div>{/cal_cell_content_today}
{cal_cell_no_content}<span class="day_listing">{day}</span>&nbsp;{/cal_cell_no_content}
{cal_cell_no_content_today}<div class="today"><span class="day_listing">{day}</span></div>{/cal_cell_no_content_today}

';

My issue is:

$count = $this->cal->countByDate($this->uri->segment(2) . "-" . $this->uri->segment(3) . "-" . "22");

I need to turn that day, "22", into {day} so the calendar will input the day for me.

Like it uses it in the template here:

{cal_cell_no_content}<span class="day_listing">{day}</span>&nbsp;{/cal_cell_no_content}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?
    • ¥15 matlab(相关搜索:紧聚焦)
    • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
    • ¥15 路易威登官网 里边的参数逆向
    • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
    • ¥50 需求一个up主付费课程