?
avatar bassmanpaul
bassmanpaul
31 May 2017

Currently templates that want to perform ajax queries would need to be installed as a package with an ajax plugin in order to make calls. This seems like a lot of extra bloat for a template to include.

Instead, could the ajax component be extended to allow support for templates? Perhaps using a similar helper method to the module, like: class TplMyTemplateHelper?

I don't mind creating a basic concept/pull request.

Additional comments

Direct calls to bypass the root index.php file are an alternative solution but would be blocked by popular security extensions.

avatar bassmanpaul bassmanpaul - open - 31 May 2017
avatar joomla-cms-bot joomla-cms-bot - change - 31 May 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 31 May 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 31 May 2017
Category com_ajax
avatar tonypartridge
tonypartridge - comment - 31 May 2017

In what scenario is a template manipulating data on the fly? :-/

avatar bassmanpaul
bassmanpaul - comment - 1 Jun 2017

So for example templates in the back-end config screen tend to have large amounts of settings these days as they become more like page builders, so loading all data in at once becomes unviable.

My particular template would like to lazy load the data when the user selects the config tab they want rather than wait for the entire form to load.

avatar tonypartridge
tonypartridge - comment - 1 Jun 2017

But does that mean that your templates are becoming too complicated? Do we really want to allow so much interaction with Templates? @brianteeman what are your thoughts?

avatar Bakual
Bakual - comment - 1 Jun 2017

Since we alreay have support for modules, why not templates as well? They are similar in that they don't have a way to directly call a function from their own code, unlike components.

avatar mbabker mbabker - change - 1 Jun 2017
Status New Discussion
avatar bassmanpaul
bassmanpaul - comment - 2 Jun 2017

If a template needs to start setting parameters on a per module region basis such as background colours, images, padding, widths, responsive breakpoints etc then the number of parameters can quickly increase.

Also some templates load in a full page builder style interface to allow for complete control over the styling and module region position, so another reason for ajax support.

It may look like they are getting too complicated but with the number of websites builders increasing in popularity on the web, users are requiring more from their Joomla templates.

avatar mbabker mbabker - change - 2 Jun 2017
Labels Added: ?
avatar mbabker mbabker - labeled - 2 Jun 2017
avatar tonypartridge
tonypartridge - comment - 4 Jun 2017

Great, waiting for a PR :-)

avatar bassmanpaul
bassmanpaul - comment - 5 Jun 2017

Done :)

The basic premise is that the front end can only access the current menu item's template (in a similar way to the module behaviour).

The back end is allowed full access, because users are more authorised, and templates can access themselves when in the template manager's edit style config page.

avatar zero-24
zero-24 - comment - 5 Jun 2017

Closing as we have a PR thanks #16532

avatar zero-24 zero-24 - change - 5 Jun 2017
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2017-06-05 11:56:41
Closed_By zero-24
avatar zero-24 zero-24 - close - 5 Jun 2017
avatar zero-24 zero-24 - change - 5 Jun 2017
Labels Removed: ?
avatar zero-24 zero-24 - unlabeled - 5 Jun 2017

Add a Comment

Login with GitHub to post a comment