remove inline javascript?

pri

New Member
Hi,

I've written a detail view template not using any html form at all. Is it possible to keep Fabrik from inserting inline javascript for just these pages?
 
I doubt it - what inline js are you refering to? I thought we put all our js in the head
 
I doubt it - what inline js are you refering to? I thought we put all our js in the head

I already removed several scripts from the head by

$removejs = array (
'/media/system/js/calendar.js',
'/media/system/js/calendar-setup.js',
'/media/system/js/core.js',
'/media/system/js/mootools-core.js',
'/media/system/js/mootools-more.js',
'/media/system/js/caption.js',
'/media/com_fabrik/js/lib/head/head.min.js'
);
foreach ($document->_scripts as $key => $value) {
if( in_array($key, $removejs ) ) {
unset($document->_scripts[$key]);
}
}

I'd like to also get rid of all inline js from the head (calendar, validation, ...) for that single form view template only.
 
We use the document API's addScriptDeclaration() method to add inline scripting, so those gets added to $document->_script (as opposed to _scripts).

So your best bet is probably to var_dump($document->_script) from your template, and work out the best way to identify the ones you need to zap. Which in most cases will be ones that start with head.js.

FYI, the reason we include most of our script inline using head.js(), rather than just including them as simple static script declarations in the page head, is we need to handle script inclusion differently when processing AJAX responses, popup windows, etc.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top