1 ckm Jan 17, 2009 18:08
3 ckm Jan 17, 2009 19:56
as a follow-up, can I provide and access that stylesheet from within the plug-in, or do I have to instruct users to modify their skin's stylesheets?
4 yabba Jan 18, 2009 07:57
Usually a plugin ( that requires styles ) ships with it's own stylesheet and adds it to a skin like this :
/**
* Spits out the styles used
*
* @see Plugin::SkinBeginHtmlHead()
*/
function SkinBeginHtmlHead()
{
require_css( $this->get_plugin_url().'style.css', true );
}
¥
5 ckm Jan 18, 2009 23:57
Ok, I'm still not getting it!
I read the docs for [url=http://doc.b2evolution.net/HEAD/evocore/_blogs---inc---_core---_template.funcs.php.html#functionrequire_css]require_css()[/url] and the code within [url=http://doc.b2evolution.net/HEAD/__filesource/fsource_evocore__blogsinc_core_template.funcs.php.html#a520]_template.funcs.php[/url] and this is supposed to output a stylesheet link, ie.
<link rel="stylesheet" href="templates/subSilver/subSilver.css" type="text/css"/>
I added the function Yabba provided above, but when I saved the file, refreshed the page and viewed the page source, I didn't see my stylesheet link (recaptcha.css).
I looked at the creativecommons_plugin code, because that stylesheet is printed in the source of the page, and the author of that plugin manually provided the stylesheet link:
function SkinBeginHtmlHead() {
echo "\n".'<link rel="stylesheet" type="text/css" href="'.$this->get_plugin_url().'cclicense.css" />'."\n";
}
I tried this method, but did not get the same results. How can I debug this process to determine why my code is apparently not being executed?
Thanks.
6 ckm Jan 19, 2009 00:09
A quick follow-up:
Out of desperation, I went into the backoffice, disabled my plugin and then re-enabled it. After this, I refreshed the page and the stylesheet link was there!
Hopefully this bit of knowledge will save someone some frustration and time in the future!
7 yabba Jan 19, 2009 09:15
Sorry, I forgot to say that when you add new hooks to a plugin you need to goto admin > global settings > plugin install and click "reload plugins"
The require_css() method is the most future proof ;)
¥
No there is no B2evo trick. This is simple XHTML.
and some stylesheet:
The <center> tag is deprecated and replaced by
however that will only center inline elements. An image is a block element.
In your situation it's easiest to use some existing class that already centers images. That saves you adding the extra css/stylesheet.
Good luck