With this URL we can get the component output, including the JS, CSS files and the html, head, body tags:
www.site.any/alias-example?tmpl=component
<html>
<head>
// JS and CSS files loads here
</head>
<body>
<div id="mycomponent">
// component's code loads here
</div>
</body>
</html>
What if I want to load just the component while using ajax?
www.site.any/alias-example?tmpl=ajax
<div id="mycomponent">
// component's code loads here
</div>
N/A
N/A
N/A
Having this file won't damage the core. It would make Joomla more flexible.
No, it doesn't damage core, but IMO it's not core's job to ship tools for every possible scenario the user base can think of. This gets into a case of is this something that the core system really needs to ship with, and I think it's a case that leans toward no.
I disagree. If we can increase the possibilities for the CMS, why not?
I'm not saying that adding new features is a bad idea. I just don't agree that the Joomla core needs to carry the weight of every possible feature every possible user might need. To me this is an edge case feature that the Joomla core does not need to provide. Not to mention that AJAX requests for full HTML is IMO a bad idea to begin with.
I think it need only for template developers, but they already can add it to its own template without problem.
Extension developers already have a loot possibility to do "ajax stuff".
Ajax was just an example, but not the only.
Another one is to embed an article/component view into an external website within an iframe:
<iframe src="http://www.site.any/alias-example?tmpl=ajax"></iframe>
Isn't an iframe supposed to have a full HTML document within it (including proper <html>
tags)?
You're right! Obviously I didn't thought properly that last one
You can of course also use a plugin together with com_ajax to do that. No need for an ajax.php file then.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-07-19 18:37:30 |
Closed_By | ⇒ | htmgarcia |
I appreciate your thoughts, guys!
Labels |
Added:
?
|
You can create your own
ajax.php
file in the template and use it. As long as you have a file matching thetmpl
parameter it works. No need for Joomla core to support a varying degree of possibilities beyond the basics.