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.

Customising the CMS /

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

URLParams > Page Not Found?


Go to End


711 Views

Avatar
Garrett

Community Member, 245 Posts

15 March 2012 at 4:51am

Hi,

I am attempting to create a filter on a SQLQuery much like the Blog module does using:

http://www.mysite.com/blog/tag/my+tag

...using $allowed_actions array and a function:

function SelectedSector() {
       return ($this->request->latestParam('ID') == 'sector') ? Convert::raw2xml($this->request->latestParam('OtherID')) : '';
}

...where my URL structure is:

http://www.mysite.com/clients/filter/sector/Digital+Media

As you can see I have another step in that URL which is why I am using the ID and then the OtherID params (instead of the standard 'Action' and then 'ID').

I then want to take the output of this SelectedSector function and use it to build a string for my query. Again, exactly like the 'tagCheck' variable in the BlogTree (function Entries()).

I am echoing $this->request->latestParams() in my Page class and everything looks good there. I am getting 'sector' as my ID and 'Digital+Media' as my OtherID. However, I am getting a Page Not Found error when I make the request! In the blog module, there is no Page whose URL is "tag," yet this works there. What am I doing wrong? I tried to copy this functionality as closely as possible. Why would I need a Page with this exact URL for this to work? I thought that was the whole point of the $allowed_actions array. What am I missing?

I've attached the file in question.

Thanks SS Gurus,
Garrett