Joomla 2.5 Loading javaScript Files inside default.php -
Joomla 2.5 Loading javaScript Files inside default.php -
i making component in joomla 2.5 contains default view.html , tmpl/default.php layout file need add together javascript code default.php file , added using
$document->addscript(juri::base() . "components/com_mycomp/javascript/myfile1.js"); $document->addscript(juri::base() . "components/com_mycomp/javascript/myfile11.js"); $document->addscript(juri::base() . "components/com_mycomp/javascript/myfile12.js"); it working fine ( tried adding document.write() within every js) , problem have code within default.php within
<script>window.jquery || document.write('<script src="components/com_mycomp/myfile3.js"><\/script>');</script> i tried print within nil works far... tried using juri::base. "path" within php tags
am doing wrong? how can in joomla way help , advices needed.
three's no need add together using document.write. import scrip file correctly, can either using first approach, or using jhtml method so:
jhtml::_('script', 'components/com_mycomp/javascript/myfile1.js'); jhtml::_('script', 'components/com_mycomp/javascript/myfile11.js'); jhtml::_('script', 'components/com_mycomp/javascript/myfile12.js'); javascript php joomla
Comments
Post a Comment