Calendar class not working |
[eluser]eboxhead[/eluser]
So I'm brand spanking new to CI, and I've been playing with the calendar class. I can display the calendar just fine, do most of the prefs no issues, but as soon as I try to use the next / prev pref the thing falls apart. The initial calendar loads fine, but as soon as I try to change the month i get a 404 error. I'm using CI 1.7.2 and MAMP. the URL for calendar is http://localhost:8888/ci/index.php/test/ My controller page looks like this: Code: <?php I've copied the code straight from the user guide and adjusted the params as needed. Any suggestions? What am I missing?
[eluser]maria clara[/eluser]
you've missed the brackets in your $prefs Code: <?php
[eluser]eboxhead[/eluser]
Thanks, just tried that. When I do that the next / prev links dissapear.
[eluser]helmutbjorg[/eluser]
Your prefs were fine... remove those brackets. What is the address that is at the top when you get the 404?
[eluser]helmutbjorg[/eluser]
Does http://localhost:8888/CI/index.php/test work when you put that in the address bar and hit enter?
[eluser]danmontgomery[/eluser]
I don't use the calendar class, but it seems to me that CI would be trying to route test/2010/03, maybe you should set up routes for the calendar?
[eluser]helmutbjorg[/eluser]
Try setting your next_prev_url to this... Code: 'next_prev_url' => 'http://localhost:8888/CI/index.php/test/index/'
[eluser]eboxhead[/eluser]
Thanks, chanign the next_prev_url worked after i changed the URI segments. is that because i have an index function in the controller? is that required?
[eluser]helmutbjorg[/eluser]
The index function is required. I think the example in the user guide assumes you are making a new function rather than putting that code in the index. You could take that code out of the index and put it in a new method called test/calendar or someting like that. If you don't want to put that code in a function other than index you can hide the index bit with a route. Eg. Code: $route['test/(:num)/(:num)'] = 'test/index/$1/$2'; |
Welcome Guest, Not a member yet? Register Sign In |