I created a plugin for joomla. I have 2 files with names finarchivo.xlm an开发者_运维技巧d finarchivo.php. I want to add css file. How? That code is needed?
You should be able to create a folder inside the plugin folder with the name of your plugin. Inside that folder you could create a 'style.css' sheet or something that you reference from within your plugin. Just use that with your elements used in your plugin..
A quick glance into my plugins content folder on a local development site and I was able to nab this from a plugin that loads it's own css sheet, they implemented it like so:
$doc->addStyleSheet(JURI::base() . "plugins/content/componentname/style.css");
So that component grabs it's css from that style.css sheet and all of the elements created by that plugin use the appropriate classes/id's.
So I guess you could do something similar - create a folder called 'finarchivo' in the folder, then create a css sheet called 'style.css' within that folder.
In your finarchivo.php sheet you would then load that CSS sheet using a method similar to what I wrote above:
$doc->addStyleSheet(JURI::base() . "plugins/content/finarchivo/style.css");
enter code here
$document =JFactory::getDocument();
$document->addStyleSheet(JURI::base() . 'yor address');
$style =' your css';
$document->addStyleDeclaration( $style );
精彩评论