components/com_component/controller.php
& other file is components/com_helloworld/helloworld.php
which is pointing to controller.php
file to execute the request. You create new controller
folder and put all controllers
in that folderThe main controller is typically used to do what you mention in your comment (render a view based on the
view
parameter, usually specified in the URL). In controller.php
, the function that does this is called display()
. So the following URL:http://example.com/index.php?option=com_mycomponent&view=test
Will result in calling the
display()
function in controller.php
and loads the view test
in /views/test
.Subcontrollers, in the
controllers
folder, are generally used for CRUD tasks, but can be called easily by using a task
URL parameter. For example:http://example.com/index.php?option=com_mycomponent&task=test.process
Will result in calling the
process()
function in /controllers/test.php
- notice the task
parameter is <controllerName>.<functionName>
No comments:
Post a Comment