Hi,
I looking for best method to add new css style when I install plugin
I have something like this
But this code have two problems
1 breaks something in existing css style
2 In notemoderator.css is it the same code what is in notemoderator.min.css - minified
and unistall
Any one can help me pleas?
the best what I make for this moment and this work is
I looking for best method to add new css style when I install plugin
I have something like this
$stylesheet = array(
"sid" => "NULL",
"name" => "notemoderator.css",
"cachefile" => "notemoderator.css",
"tid" => "1",
"attachedto" => "showthread.php",
"stylesheet" => $db->escape_string('.note-normal {
background-image: url(images/notemoderator/normal.png);
background-repeat: no-repeat;
background-attachment: scroll;
background-position: 8px 12px;
background-color: #ffffff;
border: 1px solid #d4d4d4;
padding: 10px 10px 10px 30px;
border-radius: 6px 6px 6px 6px;
color: #515151;
line-height: 150%;
font-size: 13px;
clear: both;
}
.note-information {
background-image: url(images/notemoderator/information.png);
background-repeat: no-repeat;
background-attachment: scroll;
background-position: 8px 12px;
background-color: #ebfcdf;
border: 1px solid #a4cfa4;
padding: 10px 10px 10px 30px;
border-radius: 6px 6px 6px 6px;
color: #0e440e;
line-height: 150%;
font-size: 13px;
clear: both;
}
.note-warn {
background-image: url(images/notemoderator/warn.png);
background-repeat: no-repeat;
background-attachment: scroll;
background-position: 8px 12px;
background-color: #f3e3e6;
border: 1px solid #e599aa;
padding: 10px 10px 10px 30px;
border-radius: 6px 6px 6px 6px;
color: #80001c;
line-height: 150%;
font-size: 13px;
clear: both;
}'),
'lastmodified' => TIME_NOW
);
$db->insert_query("themestylesheets", $stylesheet);
require_once MYBB_ADMIN_DIR."inc/functions_themes.php";
$query = $db->simple_select("themes", "tid");
while($theme = $db->fetch_array($query))
{
cache_stylesheet($theme['tid'], $stylesheet['cachefile'], $stylesheet['stylesheet']);
update_theme_stylesheet_list($theme['tid'], $theme, true);
}
But this code have two problems
1 breaks something in existing css style
2 In notemoderator.css is it the same code what is in notemoderator.min.css - minified
and unistall
$db->delete_query("themestylesheets", "name= \"notemoderator.css\"");
require_once MYBB_ADMIN_DIR."inc/functions_themes.php";
$query = $db->simple_select("themes", "tid");
while($theme = $db->fetch_array($query))
{
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/notemoderator.css");
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/notemoderator.min.css");
update_theme_stylesheet_list($theme['tid'], $theme, true);
}
Any one can help me pleas?
the best what I make for this moment and this work is
$style = ".note-normal {
background-image: url(images/notemoderator/normal.png);
background-repeat: no-repeat;
background-attachment: scroll;
background-position: 8px 12px;
background-color: #ffffff;
border: 1px solid #d4d4d4;
padding: 10px 10px 10px 30px;
border-radius: 6px 6px 6px 6px;
color: #515151;
line-height: 150%;
font-size: 13px;
clear: both;
}
.note-information {
background-image: url(images/notemoderator/information.png);
background-repeat: no-repeat;
background-attachment: scroll;
background-position: 8px 12px;
background-color: #ebfcdf;
border: 1px solid #a4cfa4;
padding: 10px 10px 10px 30px;
border-radius: 6px 6px 6px 6px;
color: #0e440e;
line-height: 150%;
font-size: 13px;
clear: both;
}
.note-warn {
background-image: url(images/notemoderator/warn.png);
background-repeat: no-repeat;
background-attachment: scroll;
background-position: 8px 12px;
background-color: #f3e3e6;
border: 1px solid #e599aa;
padding: 10px 10px 10px 30px;
border-radius: 6px 6px 6px 6px;
color: #80001c;
line-height: 150%;
font-size: 13px;
clear: both;
}";
$stylesheet = array(
"sid" => "NNULL",
"name" => "notemoderator.css",
"cachefile" => "notemoderator.css",
"tid" => "1",
"attachedto" => "showthread.php",
"stylesheet" => $db->escape_string($style),
'lastmodified' => TIME_NOW
);
$db->insert_query("themestylesheets", $stylesheet);
require_once MYBB_ADMIN_DIR."inc/functions_themes.php";
cache_stylesheet(1, "notemoderator.css", $style);
update_theme_stylesheet_list(1, false, true);
$db->delete_query("themestylesheets", "name= \"notemoderator.css\"");
require_once MYBB_ADMIN_DIR."inc/functions_themes.php";
$query = $db->simple_select("themes", "tid");
while($theme = $db->fetch_array($query))
{
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/notemoderator.css");
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/notemoderator.min.css");
update_theme_stylesheet_list($theme['tid'], false, true);
}