I'm trying to understand the tutorial at https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Adding_a_view_to_the_site_part,
but I don't understand the last line of code (
<?php /** * @package Joomla.Administrator * @subpackage com_helloworld * * @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // No direct access to this file defined('_JEXEC') or die('Restricted access'); // Get an instance of the controller prefixed by HelloWorld $controller = JControllerLegacy::getInstance('HelloWorld'); // Perform the Request task $input = JFactory::getApplication()->input; $controller->execute($input->getCmd('task')); // Redirect if set by the controller $controller->redirect();
I looked at https://api.joomla.org/cms-3/classes/Joomla.CMS.MVC.Controller.BaseController.html#method_redirect to find what this
redirect() actually does, but it does nothing and just returns a boolean value or maybe I am misunderstanding.
I wonder where this
redirect() leads to. Does this
redirect() follow certain rules that I didn't yet see? Does
redirect() lead to a fixed URL?.