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

Does everything user-facing need to be in a page?


Go to End


3 Posts   1277 Views

Avatar
Judge

Community Member, 79 Posts

23 February 2010 at 11:24pm

Not sure if this is the right place to ask, but does every function of a site or application that has some user-facing component to it need to be in a page, i.e. in the admin site content tree?

For example, if I have a module that supplies an AJAX form item, does that module need to supply a page in the site structure to serve the AJAX requests? Or can user-serving URLs bypass the site structure tree completely and just go direct to a module?

-- Jason

Avatar
Willr

Forum Moderator, 5523 Posts

24 February 2010 at 2:52pm

It doesn't need a page, you can simply have a plain jane controller which returns the data. Something like AjaxController extends Controller then you can call functions like site.com/AjaxController/function or to make it nicer you can add your own Director rules to make a 'nice' url like site.com/ajax/function which uses the AjaxController class

http://doc.silverstripe.org/doku.php?id=controller
http://doc.silverstripe.org/doku.php?id=director#default_rewrite_rules

Avatar
Judge

Community Member, 79 Posts

24 February 2010 at 10:24pm

I just discovered the Director class last night - it explains a lot. Thanks.

-- Jason