Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Diary Module Problem with Previous/Next month


Go to End


3 Posts   2343 Views

Avatar
Varberg

Community Member, 15 Posts

7 April 2009 at 6:36am

I'm not sure if this should be in this forum or the widget forum but here goes.

I wondered if anyone else had the same problem and found a a solution.

When I press on the "Previous" or "next" to change the month of the diary widget I get an error:

[Notice] Use of undefined constant month - assumed 'month'
GET /silverstripe/my-diary/setMonth/?month=1235862000&back=my-diary

Line 320 in C:\wamp\www\silverstripe\diary\code\DiaryHolder.php
Source

311 		Session::set("EventType",$_GET['name']);
312 		$cal = DataObject::get_one('DiaryHolder');
313 		Director::redirect($cal->URLSegment . "/");
314 	}
315 	
316 	/*
317 	 * Set the month for the calendar widget
318 	 */
319 	function setMonth(){
320 		Session::set("CalMonth",(int)$_GET[month]);
321 		Director::redirect($_GET['back']."/");
322 	}
323 	
324 	/*
325 	 * Events RSS Feed Link
326 	 */

Trace

    * DiaryHolder_Controller->setMonth(HTTPRequest)
      Line 162 of Controller.php
    * Controller->handleAction(HTTPRequest)
      Line 107 of RequestHandler.php
    * RequestHandler->handleRequest(HTTPRequest)
      Line 122 of Controller.php
    * Controller->handleRequest(HTTPRequest)
      Line 19 of ModelAsController.php
    * ModelAsController->handleRequest(HTTPRequest)
      Line 262 of Director.php
    * Director::handleRequest(HTTPRequest,Session)
      Line 106 of Director.php
    * Director::direct(/my-diary/setMonth/)
      Line 115 of main.php

Avatar
Varberg

Community Member, 15 Posts

20 April 2009 at 7:00pm

Edited: 20/04/2009 7:02pm

I contacted the module's author and he gave me this fix, which worked.

it seems like a little bug which fires on your server, it is WAMP I think.

anyway to prevent it replace the line number 320 with the following.

Session::set("CalMonth",(int)$_GET['month']);

Avatar
Nivanka

Community Member, 400 Posts

29 April 2009 at 4:16am

Sorry for not being able to reply to this earlier, anyway thanka Varberg for posting my solution on the forum.