Previously I was looking into how to get the template I'm currently editing, now I need to make use of a templates/templateName/helper.php file which would need a different kind of request.

// this gets me the template
$app = Factory::getApplication('site');
$template = $app->input->getValue('template');


How can I get the params from the input for the known $template?

2 Answers 2


If you want to access the parameters of a specific template inside the Helper, you could write a small database query, like so:

use Joomla\CMS\Factory;
use Joomla\Registry\Registry;

class TplCassiopeiaHelper
    private $params = null;

    public function __construct()
        $this->params = $this->getParams();

        // You can now access specific parameters, inside the class, for example:
        // $this->params->get('colorName')

    protected function getParams()
        $db = Factory::getDbo();

                ->where('template = ' . $db->q('cassiopeia'))
                ->where('client_id = 0')
        $registry = new Registry;

        return $registry;

Or, when you instantiate the helper class, you could pass $this->params as a constructor argument.

  • Say I instantiate a new TplCassiopeiaHelper inside its doSomeAjax method, where/what would be the source of $this->params in that case?
    – thednp
    Mar 12, 2021 at 14:35
  • 1
    You don't need to instantiate the class inside its own ajax method. Instantiate the class once and pass in the template parameters via the constructor if you want
    – Lodder
    Mar 12, 2021 at 16:52

You can do it like this example:


In this instance my XML looks like this:

    <fields name="params">
        <fieldset name="advanced">
            <field name="sitedescription"
            <field name="framework" type="list" default="bootstrap4" required="true" label="TPL_STARTER_BOOTSTRAP_4_LABEL" description="TPL_STARTER_BOOTSTRAP_4_DESCRIPTION">
                <option value="">TPL_STARTER_BOOTSTRAP_4_DEFAULT_OPTION</option>
                <option value="bootstrap4">Bootstrap4</option>
                <option value="foundation6">Foundation 6</option>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.