Your Cart is currently empty!
Product update
Coupon
add
Coupon code invalid! Please re-enter!
AJAX loader
You are here: HomeForum
Welcome, Guest

why this template not support addScriptDeclaration ?!
(1 viewing) (1) Guest
  • Page:
  • 1
  • 2

TOPIC: why this template not support addScriptDeclaration ?!

why this template not support addScriptDeclaration ?! 7 years, 11 months ago #30668

hi
why the sj news ii dont support the addScriptDeclaration code ?


thanks

Re: why this template not support addScriptDeclaration ?! 7 years, 11 months ago #30674

  • usersmart1
  • OFFLINE
  • Moderator
  • Posts: 1364
  • Karma: 20
Dear Sofian11,

Please add the code:

$doc = JFactory::getDocument();
$doc->addScriptDeclaration( $script );

to your module code. With $script = your script on the module.
You can refer at: docs.joomla.org/JDocument/addScriptDeclaration

Thanks & regards!

Re: why this template not support addScriptDeclaration ?! 7 years, 11 months ago #30687

please understand me again ::

i have a video component , it has somthing not works ....
after i contact them they tell me that my template not support "addScriptDeclaration" .

then they chang their this code :

$document->addScriptDeclaration('yendifplayer.config = ' . YendifVideoShareUtils::jsonEncode( $_config ) . ';');

to this code :

$document->addCustomTag('<script type="text/javascript">yendifplayer.config = ' . YendifVideoShareUtils::jsonEncode( $_config ) . ';</script>');

then the issue fixed ...

why i must change on my models and components ?
why my template not support it by default ?

thanks

Re: why this template not support addScriptDeclaration ?! 7 years, 11 months ago #30703

  • usersmart1
  • OFFLINE
  • Moderator
  • Posts: 1364
  • Karma: 20
Dear sofian10,

We will note this issue for the next update and inform to you as soon as possible.

Thanks & regards!
The following user(s) said Thank You: sofian10

Re: why this template not support addScriptDeclaration ?! 7 years, 11 months ago #30704

ok
thanks

Re: why this template not support addScriptDeclaration ?! 7 years, 11 months ago #30814

hi
the fix is this ::

Open file plugins/system/yt/yt.php, then you comment this code:
if($app->isSite() && !$k2detail && !$config_module && $layout== null && !$comMedia && $disMootool) {
// Remove default mootools

unset($doc->_scripts[JURI::root(true) . '/media/system/js/core.js']);
unset($doc->_scripts[JURI::root(true) . '/media/system/js/modal.js']);
unset($doc->_scripts[JURI::root(true).'/media/system/js/caption.js']);
unset($doc->_scripts[JURI::root(true) . '/media/system/js/mootools.js']);
unset($doc->_scripts[JURI::root(true).'/media/system/js/mootools-core.js']);
unset($doc->_scripts[JURI::root(true).'/media/system/js/mootools-more.js']);

unset($doc->_styleSheets[JUri::root(true) . '/media/system/css/modal.css']);


if (isset($doc->_script) && isset($doc->_script['text/javascript']))
{
$doc->_script['text/javascript'] = preg_replace('%window\.addEvent\(\'load\',\s*function\(\)\s*{\s*new\s*JCaption\(\'img.caption\'\);\s*}\);\s*%', '', $doc->_script['text/javascript']);
$doc->_script['text/javascript'] = preg_replace('%jQuery\(window\)\.on\(\'load\'\,\s*function\(\)\s*\{\s*new\s*JCaption\(\'img\.caption\'\);\s*\}\);%', '', $doc->_script['text/javascript']);
$doc->_script['text/javascript'] = preg_replace('%window\.addEvent\(\'load\',function\(\)\{\s*\}\);%', '', $doc->_script['text/javascript']);

//remove SqueezeBox.initialize in behavior.php
$doc->_script['text/javascript'] = preg_replace('%SqueezeBox\.initialize\(\{\}\);\s*SqueezeBox\.assign\(\$\(\'a.modal\'\)\.get\(\)\, {\s*parse\:\s\'rel\'\s*\}\);%', '', $doc->_script['text/javascript']);

// Remove call to JTooltips
$doc->_script['text/javascript'] = preg_replace('%window\.addEvent\(\'domready\',\s*function\(\)\s*{\s*\$\$\(\'.hasTip\'\).each\(function\(el\)\s*{\s*var\s*title\s*=\s*el.get\(\'title\'\);\s*if\s*\(title\)\s*{\s*var\s*parts\s*=\s*title.split\(\'::\',\s*2\);\s*el.store\(\'tip:title\',\s*parts\[0\]\);\s*el.store\(\'tip:text\',\s*parts\[1\]\);\s*}\s*}\);\s*var\s*JTooltips\s*=\s*new\s*Tips\(\$\$\(\'.hasTip\'\),\s*{\s*\"maxTitleChars\":\s*[\d]*,\s*\"fixed\":\s*false}\);\s*}\);%', '', $doc->_script['text/javascript']);
$doc->_script['text/javascript'] = preg_replace('%jQuery\s*function\(\)\s*{\s*\$\$\(\'.hasTip\'\).each\(function\(el\)\s*{\s*var\s*title\s*=\s*el.get\(\'title\'\);\s*if\s*\(title\)\s*{\s*var\s*parts\s*=\s*title.split\(\'::\',\s*2\);\s*el.store\(\'tip:title\',\s*parts\[0\]\);\s*el.store\(\'tip:text\',\s*parts\[1\]\);\s*}\s*}\);\s*var\s*JTooltips\s*=\s*new\s*Tips\(\$\$\(\'.hasTip\'\),\s*{\s*\'maxTitleChars\':\s*[\d]*,\s*\'fixed\':\s*false}\);\s*}\);%', '', $doc->_script['text/javascript']);
$doc->_script['text/javascript'] = str_replace($doc->_script['text/javascript'],'',$doc->_script['text/javascript']);

if (empty($doc->_script['text/javascript']))
unset($doc->_script['text/javascript']);
}

}
  • Page:
  • 1
  • 2
Time to create page: 0.27 seconds

Notification

Please find your issue via Suggested Posts before submitting your question. We have solved the most of issues and maybe your issue was solved before.

Latest My Topics

No posts to display.

Love all our templates?

Join our membership clubs starting at $49 only for access to all of our templates

Join Now
Home Pricing
Your Cart is currently empty!
Product update
Coupon
add
Coupon code invalid! Please re-enter!
AJAX loader
SearchSupport
Magento Themes Magento Extensions Free Magento Extensions Prestashop Themes Prestashop Modules Magento 2 Themes