Welcome Guest, Not a member yet? Register   Sign In
a small mistake in documentation...
#1

[eluser]eljunior[/eluser]
in the Calendaring Class page ,
on the section Showing Next/Previous Month Links
the $prefs array is being passed as an argument to $this->calendar->generate() method instead
of to $this->load->library().

this confused me when trying to reproduce the results described, until i figured out what was going on.

(by the way, am i posting this in the right place?)
#2

[eluser]Derek Allard[/eluser]
Hey eljunior, welcome to CodeIgniter. Yes, this is absolutely the right place to post.

That said, I don't believe this is an error. generate() can take three arguments. The first is the year, the second the month, and the third is any preferences you might want, so in this example it is assuming that the year and month are in the address like this.

http://www.example.com/index.php/calendar/2006/11

Would that explain the results you saw?

Thanks again for posting, and welcome aboard.
#3

[eluser]eljunior[/eluser]
thank you for the welcome and answer. ;-)

i don't think so.

before posting, i tried it and it didn't worked until i passed my array $prefs
as the others examples show, in the same page:

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

but, if it's possible to pass the array of preferences to
generate(), do i have to set some option in some place?
#4

[eluser]Derek Allard[/eluser]
To be honest, I've not used the calendar class, and I'm going on a quick read through the code. If you could create me a sample controller to test with, then I can verify the bug and get it fixed up for you. Could you post the controller you were using?
#5

[eluser]eljunior[/eluser]
well, i think there is nothing wrong in the code, but in the example in the documentation.

here is my code:

Code:
class Calendar extends Controller {

        function Calendar()
        {
                parent::Controller();
        }

        function index()
        {
                $cal_prefs=array(
                        'show_next_prev'  => TRUE,
                        'next_prev_url' => 'http://localhost/~eljunior/codeigniter/calendar/index/'
                );
                $this->load->library('calendar', $cal_prefs);
                $data['calendar'] = $this->calendar->generate(
                        $this->uri->segment(3),
                        $this->uri->segment(4));
                $this->load->view('calendar', $data);
        }

        function doesntwork()
        {
                $this->load->library('calendar');
                $cal_prefs=array(
                        'show_next_prev'  => TRUE,
                        'next_prev_url' => 'http://localhost/~eljunior/codeigniter/calendar/doesntwork/'
                );
                $data['calendar'] = $this->calendar->generate(
                        $this->uri->segment(3),
                        $this->uri->segment(4), $cal_prefs);
                $this->load->view('calendar', $data);
        }
}

the index method works fine.
the doesntwork method doesn't work as expected. Smile

it seems to me it's just the example it's wrong, cause looking in the same page,
the other examples pass $prefs when loading the library.

am i right?
#6

[eluser]Derek Allard[/eluser]
Wonderful, I'm a believer! Smile

I've fixed it up in the subversion repository, and it'll be part of the next release of CI. Thanks for your contribution Elias.
#7

[eluser]mmirkovic[/eluser]
Hi all,
I have one too ... so I think it would be OK just to attach it in this topic instead of opening new one.

in the very beginning of tutorial --> user_guide/general/urls.html

in example of .htaccess file You have line:

Code:
RewriteRule ^(.*)$ /index.php/$1 [L]

but with this You always get 404 page, because of leading / in front of index.php
should be like:

Code:
RewriteRule ^(.*)$ index.php/$1 [L]

I had tested this and works for me ... hope it helps.

regards,
m.
#8

[eluser]Derek Allard[/eluser]
Thanks mmirkovic. Welcome aboard!




Theme © iAndrew 2016 - Forum software by © MyBB