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.

Customising the CMS

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


Reply

3 Posts   852 Views

Avatar
Judge

23 February 2010 at 11:24pm Community Member, 79 Posts

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

24 February 2010 at 2:52pm Forum Moderator, 5511 Posts

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

24 February 2010 at 10:24pm Community Member, 79 Posts

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

-- Jason