Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem and solution for using segments = true #6

Open
meltz opened this issue Jul 31, 2014 · 2 comments
Open

Problem and solution for using segments = true #6

meltz opened this issue Jul 31, 2014 · 2 comments

Comments

@meltz
Copy link

meltz commented Jul 31, 2014

This is a good calendar package, just want to share the problem encountered and how to solve it. If you set segment to true and have problem navigating to the next or prev month due to duplicated year and month parameters url.

In vendor\gloudemans\calendar\src\Gloudemans\Calendar, change line 26 from
$this->next_prev_url = $request->url(); to
$this->next_prev_url = $request->root().'/'.$request->segment(1);

@meltz meltz changed the title Solution and problem for using segments = true Problem and solution for using segments = true Jul 31, 2014
@craigsssmith
Copy link

@meltz: Your solution only works when the calendar is on a page that has a URL that consists of only a single segment. It'd be handy if there were a config option for setting the base url of the page that the year and month parameters get appended to. I'll try to find time to put together a pull request soon.

@zawaruddin
Copy link

try this code... i use this code in CI and Laravel

public function calendar($y = null, $m = null){
      $config = array('show_next_prev'  => true,
                         'next_prev_url'  => url('calendar'),
                         'segments' => true);
      Calendar::initialize($config);
      echo Calendar::generate($y, $m);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants