用户
 找回密码
 入住 CI 中国社区
搜索
查看: 3339|回复: 7
收起左侧

[讨论/交流] CodeIgniter 框架下一月/上一月链接设置

[复制链接]
发表于 2009-9-8 16:58:10 | 显示全部楼层 |阅读模式
$prefs = array (
               'show_next_prev'  => TRUE,
               'next_prev_url'   => 'http://localhost/zhangjs'
);
$this->load->library('calendar',$prefs);
$calendar_array = $this->calendar->generate();
你必须向日历创建函数提供"年"和"月"通过他们应该出现的URI段

请问'next_prev_url'   => 'http://localhost/zhangjs'后面怎么设置?
 楼主| 发表于 2009-9-8 17:01:19 | 显示全部楼层
补充一下  我点击上个月 url  http://localhost/zhangjs/2009/08/
                下个月 url  http://localhost/zhangjs/2009/10/


页面报错信息为  404 Page Not Found
                The page you requested was not found.
发表于 2009-9-9 09:25:08 | 显示全部楼层
本帖最后由 kazaff 于 2009-9-9 09:26 编辑

$prefs = array (
               'show_next_prev'  => TRUE,
               'next_prev_url'   => 'http://example.com/index.php/calendar/show/'
             );

$this->load->library('calendar', $prefs);

echo $this->calendar->generate($this->uri->segment(3), $this->uri->segment(4));

评分

参与人数 1威望 +2 收起 理由
Hex + 2 支持!

查看全部评分

发表于 2009-9-9 11:33:22 | 显示全部楼层
HEX万岁
 楼主| 发表于 2009-9-9 14:06:21 | 显示全部楼层
假设当前日期是2009年9月
'next_prev_url'   => 'http://example.com/index.php/calendar/show/'
你把next_prev_url 设置成上面的形式,这时你点击上一个月按钮时的url如下:
http://example.com/index.php/calendar/show/2009/8
你是不是要建立calendar,show,2009和8的文件夹?
且你点击后跳转到控制器那个文件进行换月处理?
发表于 2009-9-9 14:19:16 | 显示全部楼层
不需要建立文件夹吧?那后面的数字是参数。
并且,应该都是有日历类库自动处理吧?根据手册写就 OK
 楼主| 发表于 2009-9-9 14:23:19 | 显示全部楼层
那为什么我点击上个月的按钮url如下
http://localhost/zhangjs/calendar/2009/08
然后页面就提示404 Page Not Found
The page you requested was not found.
我是按照手册的方法写的就是不知道为什么原因?
发表于 2012-6-1 15:57:22 | 显示全部楼层
不知道这个问题解决了没有~~~

本版积分规则