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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Simple Page_Controler Function giving 404?


Go to End
Reply


2 Posts   686 Views

Avatar
otherjohn

Community Member, 125 Posts

11 June 2010 at 7:46am

Hi all

in my /mysite/code/page.php
i have

 class Page_Controller extends ContentController { 

public function  MobileOff(){
    	$_SESSION['mobilePhone']="None";
   		Director::redirect(Director::baseURL().$this->URLSegment);
	}

but when I navigate to site.com/MobileOff it gives me a page cannot be found.
What am I missing?
John

Avatar
Willr

Forum Moderator, 5514 Posts

11 June 2010 at 7:28pm

Well because out of the box the URL rules will match that to a Page. To do that you would have to use the url

site.com/home/MobileOff

And make sure its an allowed action. http://doc.silverstripe.org/security#security_in_controllers