Smutty_Object
|
+--Smutty_Controller
public class Smutty_Controller
extends Smutty_Object
| Method Summary | |
|---|---|
| nothing | action(String name) executes an action on the current controller |
| protected nothing | actionBefore(Smutty_Data data, Smutty_Session session) this function is called before an action. |
| nothing | addError(String message) adds an error to this controller |
| static nothing | addErrors(array errors) adds errors to the current controller |
| String | get(String name) returns the value of a template var |
| nothing | push(String name, String value) this function pushes a value onto the named array, if the array doesn't exist then it's created. |
| protected nothing | redirect(array params, array args) redirects the user to the given url. |
| protected nothing | redirectJs(array params) this function takes the same arguments as the normal redirect function, but prints out javascript code to do the redirect itself. |
| protected nothing | redirectUrl(String url) redirects the user to the application url specified. |
| nothing | set(String name, mixed value) sets a variable for use by the template |
| nothing | smuttyView(String viewFile) show the view file using the smutty template class |
| protected nothing | view(String viewFile) show the specified file with the standard user template class. |
public nothing action(String name)
executes an action on the current controller
protected nothing actionBefore(Smutty_Data data, Smutty_Session session)
this function is called before an action. it has no implementation here but can be over-rided by sub-classes if they want to use it.
public nothing addError(String message)
adds an error to this controller
public static nothing addErrors(array errors)
adds errors to the current controller
public String get(String name)
returns the value of a template var
public nothing push(String name, String value)
this function pushes a value onto the named array, if the array doesn't exist then it's created.
protected nothing redirect(array params, array args)
redirects the user to the given url. the parameter array should be a hash of name value pairs. the names being anything set up for the route.
protected nothing redirectJs(array params)
this function takes the same arguments as the normal redirect function, but prints out javascript code to do the redirect itself. this can be useful when doing ajax callbacks with forms.
it would be nice if i could think of a way to merge these two methods and have it "know" which one to do, but that seems a bit impossible i think?
protected nothing redirectUrl(String url)
redirects the user to the application url specified. the url must be absolute from the base of the app.
public nothing set(String name, mixed value)
sets a variable for use by the template
public nothing smuttyView(String viewFile)
show the view file using the smutty template class
protected nothing view(String viewFile)
show the specified file with the standard user template class. if the view file is not specifed then it is assumed to be located as "views/controller/action.tpl"
this is the base class for all smutty controllers. it defines a lot of required functionality and helper methods for classes that inherit from it.
/