Add new Js,css files in joomla component

I want to insert .js files & css files into my joomla component,and call all these files in a .php file.Is anybody know whats the procedure for this. Thanks

Answers


Happen to be working on this right now. In file \com_yourcomponent\views\yourview\view.html.php, within function display(),

$document->addStyleSheet('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/smoothness/jquery-ui.css');
$document->addCustomTag('<script type="text/javascript" src="components/com_yourcomponent/js/jquery-1.7.2.min.js"></script>');

in your components use :

    $js = JUri::root() . 'mycssFolder/style.css';
    $doc = JFactory::getDocument();
    $doc->addScript($js);

for more info http://docs.joomla.org/JDocument/addScript


In Joomla! 2.5, I used the following code in the view display() :

JHtml::stylesheet(JURI::base() . 'components/com_mycomponent/css/mycomponent.css', array(), true);

The best place to ask: http://forum.joomla.org/

Ok, ok, for the downvoters: stackoverflow.com :)


Need Your Help

Is AES 256-bit encryption possible with GlassFish 4.0?

ssl encryption glassfish aes

I'm running an application on a GlassFish 4.0 server that I want to secure with the strongest encryption possible (or at least as close to this as possible).