将年/月/日作为链接在codeigniter日历类中 [英] Getting the year/month/day as a link in codeigniter calendar class

查看:68
本文介绍了将年/月/日作为链接在codeigniter日历类中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果有任何内容,我会尝试将一天转换为链接,因此格式将是

Im trying to convert the a day to a link if there are any content so the format will be.

site / calendar / 2012/1/2

site/calendar/2012/1/2

所以我将能够检索到相关的信息。

so i will be able to retrieve the information that is relevant.

在我的模型中有模板和其他选项,

in my model in have the template and the other options,

模型

控制器

有人可以告诉我如何获取年/月/日的日期,以便我可以检索值。

can someone please tell me how can i get the dates as year/month/day to the so i can retrieve the values.

<div class="content"><a href="year/month/{day}">View</a></div>


推荐答案

您要在 view 方法,因此您可以将它们通过 $ data 数组传递给视图:

You're setting the month and year in your view method, so you could just pass those to the view through the $data array:

// Diary Controller
$data['calendar'] = $this->diary_model->generate($year, $month);
$data['year'] = $year; // ADD THIS
$data['month'] = $month; // ADD THIS

$data['body']='diary/calender';

$this->load->view('includes/template', $data);

然后,在您的模型中可以这样设置:

then, in your model you can set it like this:

// Diary Model
$this->conf['template'] = '...
{cal_cell_content}
  <div class="day_num">{day}</div>
  <div class="content"><a href="'.$year.'/'.$month.'/{day}">View</a></div>
{/cal_cell_content}
...';

这篇关于将年/月/日作为链接在codeigniter日历类中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆