? Success

User tests: Successful: Unsuccessful:

avatar dgt41
dgt41
16 Dec 2013

The

<jdoc:include type="head" />

will still render the complete head. But using this:

<head>
<jdoc:include type="meta" />
<jdoc:include type="styles" />

you can echo the scripts at the bottom of the page
eg.:

<jdoc:include type="scripts" />
</body>
avatar dgt41 dgt41 - open - 16 Dec 2013
avatar dgt41 dgt41 - change - 16 Dec 2013
The description was changed
Description <p>The will still render the complete head. But using this:<br></p><br><br><br> .<br> .<br> .<br> you can echo the scripts at the bottom of the page<br> eg.:<br><br><p><a href="https://groups.google.com/forum/#!topic/joomla-dev-cms/qlyWQEUj63g">https://groups.google.com/forum/#!topic/joomla-dev-cms/qlyWQEUj63g</a></p> <p>The </p> <pre><code>&lt;jdoc:include type="head" /&gt; </code></pre> <p>will still render the complete head. But using this:</p> <pre><code>&lt;head&gt; &lt;jdoc:include type="meta" /&gt; &lt;jdoc:include type="styles" /&gt; </code></pre> <p>you can echo the scripts at the bottom of the page<br> eg.:</p> <pre><code>&lt;jdoc:include type="scripts" /&gt; &lt;/body&gt; </code></pre>
Status New Closed
Closed_Date 0000-00-00 00:00:00 2013-12-16 23:52:14
Labels Added: ?
avatar dgt41 dgt41 - close - 16 Dec 2013
avatar dgt41 dgt41 - close - 16 Dec 2013
avatar dgt41 dgt41 - change - 16 Dec 2013
Status Closed New
avatar dgt41 dgt41 - reopen - 16 Dec 2013
avatar dgt41 dgt41 - reopen - 16 Dec 2013
avatar Bakual
Bakual - comment - 17 Dec 2013

This will likely break Javascript in 3rd party extensions and even in core. There are scripts which need to be loaded in the head to work properly. There are also cases where we have inline scripts depending on a script being loaded previously.

The proper way is to make use of the $defer and $async flags in JDocument->addScript() (https://github.com/joomla/joomla-cms/blob/master/libraries/joomla/document/document.php#L466).

avatar Bakual
Bakual - comment - 17 Dec 2013

One a sidenote: You can use for example this plugin to achieve the same: http://extensions.joomla.org/extensions/core-enhancements/performance/scripts-optimization/12559 and see their warning:

Many extensions insert javascript into the body and head. This isn't a set-and-forget plugin. It will require tuning. Some sites cannot function without javascripts in the head, and these sites may as well not run ScriptsDown.

avatar laoneo
laoneo - comment - 19 Dec 2013

Agree with bakual, the Joomla way of adding scripts is in the head.

avatar dgt41
dgt41 - comment - 19 Dec 2013

@Bakual, @laoneo
Right now this is useless, but with the addition of methods like addScriptToHead() and addScriptToFooter() and probably doc:include type="headscripts" and doc:include type="bottomscripts" we might end up with a more modular and useful code.
there is a discussion about all these here:
https://groups.google.com/forum/#!topic/joomla-dev-cms/qlyWQEUj63g

avatar Bakual Bakual - change - 19 Dec 2013
Status New Closed
Closed_Date 2013-12-16 23:52:14 2013-12-19 12:19:28
Labels Added: ?
avatar Bakual Bakual - close - 19 Dec 2013
avatar Bakual
Bakual - comment - 19 Dec 2013

Aye, if new methods (or arguments) are added to load a script into footer, then this will work.

Closing this PR for now. You can always reopen it or create a new one if you have a testable solution.
Thanks!

avatar Bakual Bakual - close - 19 Dec 2013

Add a Comment

Login with GitHub to post a comment