URL Format

From CollectiveAccess Documentation
Jump to: navigation, search

CollectiveAccess URL Format

All system requests in Providence and Pawtucket go through a front-side controller in index.php in the root directory of your Providence installation. Unless you do rewriting of URLs (using the Apache mod_rewrite module, for example) the URL will contain a reference to index.php. A typical URL will look like this:


The components of the URL are made available via the RequestHTTP object via various methods. The components of the above URL are:

Component Description [RequestHttp RequestHTTP] method
http://mysite.com Protocol and hostname. This, of course, is the absolute part of the URL pointing to your server. None
index.php Controller file name; this is always index.php and can be obscured using URL rewriting to make the application URLs "cleaner." None
editor/objects The path, relative to your app/controllers directory, to the directory containing the controller to be accessed. This can be as long as is needed; directories can be nested to any depth. All that matters is that it resolveds to a directory that contains the controller referenced by the controller component of the URL (see next entry). getModulePath()
ObjectEditor The controller to invoke actions on. By convention the controller is a file named with the controller name + "Controller.php" defining a class of the name name, sans '.php' In this example, the filename would be ObjectEditorController.php and the defined class ObjectEditorController. All controllers are subclasses of ActionController. getController()
Edit The "action" (a method) to invoke on the specified controller. getAction()
Screen1 "Extra" action data. This string is optional and can be used to indicate the context of an action invocation. It's basically an un-named request parameter that is most often used to allow different navigation menu items to access the same controller/action call. By passing a different "extra" value the system can distinguish between the same invocation done at different locations in the navigation structure. getActionExtra()
object_id/10 Name/value pairs (separated by "/") following the action and optional action "extra" are taken to be request parameters. getParameter()

There can be any number of parameters. Just keep appending name/value pairs delimited by "/" onto the URL. For example: http://mysite.com/index.php/editor/objects/ObjectEditor/Edit/Screen1/object_id/10/mode/list/items_per_page/5 would pass the parameters object_id=10, mode=list and items_per_page=5 to the request.

To make "clean" URLs you can use mod_rewrite to obscure the index.php reference.

Clean URLs using Apache with mod_rewrite




Personal tools