开发者

Add css to joomla plugin

开发者 https://www.devze.com 2023-03-23 10:07 出处:网络
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

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 );
0

精彩评论

暂无评论...
验证码 换一张
取 消