of course (he says playind devils advote) you CAN use script includes
in an Ajax response, so there may be an argument for including this:.
Here's how
if you ajax request has the option evalScipts set to true (default it
no) then any <script> block is evaluated
However, this doesn't work directly for scripts which link to an
external script.
To get that to work you can dynamically apply them to the document
head using mootool's FBAsset.javascript() method.
Here's an example of how i overwrote JHTML::script():
function script( $filename, $path = 'media/system/js/', $mootools =
true)
{
if (JRequest::getVar( 'format' ) == 'raw') {
echo "<script type='text/javascript'>var v = new FbAsset.javascript
('" .JPATH_BASE. "', '{$path}{$filename}', {});</script>\n";
} else {
JHTML::script( $filename, $path, $mootools );
}
}
On 9 July, 15:48, Beat <
beat...@gmail.com> wrote:
> Hi Andrew,
>
> This seems coherent...either way, as long as it's coherent.
>
> Thus said, only very few methods will remain in JDocument
> though...which I'm fine with ;-)
>
> However just to be sure to "educate" right: is this the right method
> to use and will it also work in Joomla 1.6 ? :
>
> $document =& JFactory::getDocument();
> if ( $document->getType() == 'html' ) {
> // output what's needed to head ONLY in this case
> // actually you may also want to check the template used (e.g. for
> component only you don't want to output from a module....)
> }
>
> How would the second test be done ?
>
> Probably better spend the time replying writing in the API wiki
> directly, then put just url to it here, so we can try to "educate"
> with clear materials.
>
> Best Regards,
> Beat
>
> On 9 July, 00:53, Andrew Eddie <
mambob...@gmail.com> wrote:
>
> > Contact the authors of the plugins and educate them on what they are
> > doing wrong. I'll deprecate the HTML only methods in JDocument in
> > 1.6.
>
> > Regards,
> > Andrew Eddiehttp://www.theartofjoomla.com-the art of becoming a Joomla developer
>
> > 2009/7/8 Beat <
beat...@gmail.com>:
>
> > > I am not returning anything, but if you take a look at first link
> > > (yoo_effects): that plugin (bot) adds the head info to all pages...
> > > Including non-html ones.
>
> > > I'm speaking of an ajax-call through joomla's index.php?format=raw
>
> > > Same for many other plugins, modules and components. The use addHead
> > > methods without checking for the output format... and plugins execute
> > > for any output format.
>
> > > So yes, agree head is needed for html only.
>
> > > And addCustomTag is already in JDocumentHTML. Just that in
> > > JDocumentRAW, all other addHead methods are in it too as they are in
> > > JDocument that JDocumentRAW extends. So, either addStyleSheet should
> > > be in JDocumentHTML only (and breaking most plugins and modules when
> > > you use ajax), or by coherence addCustomTag should be at same place
> > > than addStyleSheet (in JDocument), and be simply ignored when
> > > outputing in RAW format.
>
> > > It's just inconsistant and as is addCustomTag bugs in many components
> > > and plugins.
>
> > > On 8 July, 14:37, Andrew Eddie <
mambob...@gmail.com> wrote:
> > >> I'd probably argue that they should not be implemented in JDocument at
> > >> all and should only reside in JDocumentHtml.
>
> > >> What are you returning in the ajax call that needs a head tag?
>
> > >> Regards,
> > >> Andrew Eddiehttp://www.theartofjoomla.com-theart of becoming a Joomla developer