Some phpBB skins use the subsilver stylesheet but replace certain styles with classes from the database. Since the classes from the database are not used in MKPortal importing the imported skin just looks like subsilver. Other skins put all styles in the stylesheet and do not use classes stored in the database or overall_header.tpl.
About 1/2 of the phpBB skins I've seen use css styles that are stored in the database and the other 1/2 of skins use the stylesheet only or put some style information in overall_header.tpl. This makes it difficult to make one importing function that will work for all possible skins.
To see what I mean you could replace function import_css in php_board_functions.php with this modified importing code. It uses the classes from the database instead of the forum stylesheet. Some skins look perfect with this new code and some that look good with the old code look terrible with this code.
function import_css()
{
global $mkportals, $DB, $mklib;
/*
$DB->query("SELECT template_name, head_stylesheet FROM " . THEMES_TABLE . " where themes_id = '{$mkportals->member['theme']}'");
$r = $DB->fetch_row();
$css2 = $mkportals->forum_url."/templates/".$r['template_name']."/".$r['head_stylesheet'];
$images_url = $mkportals->forum_url."/templates/".$r['template_name']."/images";
unset ($r);
*/
$DB->query("SELECT * FROM " . THEMES_TABLE . " where themes_id = '{$mkportals->member['theme']}'");
$r = $DB->fetch_row();
$css2 = $mkportals->forum_url."/templates/".$r['template_name']."/".$r['head_stylesheet'];
$images_url = $mkportals->forum_url."/templates/".$r['template_name']."/images";
$fh = @fopen($css2, "r");
if ($fh) {
$css2 = fread($fh, filesize($css2));
@fclose($fh);
}
$css = "$mklib->template/style.css";
$fh = @fopen($css, "r");
if ($fh) {
$css = fread($fh, filesize($css));
@fclose($fh);
}
//importing body
$pos = strpos($css2, "body");
$pos2 = strpos($css2, "}", $pos);
if ($pos) {
$mkpsubs = substr($css2, $pos, ($pos2 - ($pos -1)));
$mkpsubs = "body {font-size: 10px; font-family: Verdana, Arial, Helvetica, sans-serif;}".$mkpsubs;
$mkpsubs = preg_replace( "/background-image(.*?;)/mi", "background-image: url(images/{$r['body_background']});", $mkpsubs);
$mkpsubs = preg_replace( "/background-color(.*?;)/mi", "background-color: #{$r['body_bgcolor']};", $mkpsubs);
$css = preg_replace( "`(.importbody(.*?}))`is", $mkpsubs, $css);
}
//importing main table bg (if different than body bg)
$pos = strpos($css2, ".bodyline");
$pos2 = strpos($css2, "}", $pos);
if ($pos) {
$mkpsubs = substr($css2, $pos, ($pos2 - ($pos -1)));
$mkpsubs = preg_replace( "/background-color(.*?;)/mi", "background-color: #{$r['td_color2']};", $mkpsubs);
$css = preg_replace( "`(.importmain(.*?}))`is", $mkpsubs, $css);
}
//importing logostrip
$sflogo = $images_url."/sf_logo.jpg";
if (is_file("$sflogo") ) {
$mkpsubs = "#logostrip {background-image: url($sflogo); text-align: left;}";
} else {
$pos = strpos($css2, ".bodyline");
$pos2 = strpos($css2, "}", $pos);
$mkpsubs = substr($css2, $pos, ($pos2 - ($pos -1)));
$mkpsubs = preg_replace( "/background-color(.*?;)/mi", "background-color: #{$r['td_color2']};", $mkpsubs);
}
$css = preg_replace( "`(#importlogostrip(.*?}))`is", $mkpsubs, $css);
//importing light background
$pos = strpos($css2, "td.row1");
$pos2 = strpos($css2, "}", $pos);
if ($pos) {
$mkpsubs = substr($css2, $pos, ($pos2 - ($pos -1)));
$mkpsubs = preg_replace( "/background-color(.*?;)/mi", "background-color: #{$r['tr_color1']};", $mkpsubs);
$css = preg_replace( "`(.importlightback(.*?}))`is", $mkpsubs, $css);
}
//importing medium background
$pos = strpos($css2, "td.row3");
$pos2 = strpos($css2, "}", $pos);
if ($pos) {
$mkpsubs = substr($css2, $pos, ($pos2 - ($pos -1)));
$mkpsubs = preg_replace( "/background-color(.*?;)/mi", "background-color: #{$r['tr_color3']};", $mkpsubs);
$css = preg_replace( "`(.importmediumback(.*?}))`is", $mkpsubs, $css);
}
//importing dark background
$pos = strpos($css2, "td.catHead");
$pos2 = strpos($css2, "}", $pos);
if ($pos) {
$mkpsubs = substr($css2, $pos, ($pos2 - ($pos -1)));
$mkpsubs = preg_replace( "/background-image(.*?;)/mi", "background-image: url(images/{$r['th_class1']});", $mkpsubs);
$mkpsubs = preg_replace( "/background-color(.*?;)/mi", "background-color: #{$r['tr_color3']};", $mkpsubs);
$mkpsubs = preg_replace( "/color(.*?;)/mi", "color: #{$r['body_link']};", $mkpsubs);
$mkpsubs = preg_replace( "/border(.*?;)/mi", "border: 0;", $mkpsubs);
$css = preg_replace( "`(.importdarkback(.*?}))`is", $mkpsubs, $css);
}
//importing module table headers
$pos = strpos($css2, "th {");
$pos2 = strpos($css2, "}", $pos);
if ($pos) {
$mkpsubs = substr($css2, $pos, ($pos2 - ($pos -1)));
$mkpsubs = preg_replace( "/border(.*?;)/mi", "border: 0px;", $mkpsubs);
$mkpsubs = preg_replace( "/background-image(.*?;)/mi", "background-image: url(images/{$r['th_class2']});", $mkpsubs);
$mkpsubs = preg_replace( "/background-color(.*?;)/mi", "background-color: #{$r['body_link']};", $mkpsubs);
$mkpsubs = preg_replace( "/color(.*?;)/mi", "color: #{$r['fontcolor3']};", $mkpsubs);
$css = preg_replace( "`(.importmodulex(.*?}))`is", $mkpsubs, $css);
}
//importing borders
$pos = strpos($css2, ".bodyline");
$pos2 = strpos($css2, "}", $pos);
if ($pos) {
$mkpsubs = substr($css2, $pos, ($pos2 - ($pos -1)));
$mkpsubs = preg_replace( "/back(.*?;)/mi", "", $mkpsubs);
$mkpsubs = preg_replace( "/border(.*?;)/mi", "border: 1px #{$r['th_color1']} solid;", $mkpsubs);
$css = preg_replace( "`(.importborders(.*?}))`is", $mkpsubs, $css);
}
/*
//importing form styles
$pos = strpos($css2, "input,textarea, select");
$pos2 = strpos($css2, "}", $pos);
if ($pos) {
$mkpsubs = substr($css2, $pos, ($pos2 - ($pos -1)));
$mkpsubs = preg_replace( "/color(.*?;)/mi", "color: {$r['body_text']};", $mkpsubs);
$css = preg_replace( "`(.importforms(.*?}))`is", $mkpsubs, $css);
}
*/
//importing form styles
$pos = strpos($css2, "input.post, textarea.post, select");
$pos2 = strpos($css2, "}", $pos);
if ($pos) {
$mkpsubs = substr($css2, $pos, ($pos2 - ($pos -1)));
//$mkpsubs = "input.post, textarea.post, select { color: {$r['body_text']}; }".$mkpsubs;
//$mkpsubs = preg_replace( "/color(.*?;)/mi", "color: {$r['body_text']};", $mkpsubs);
$mkpsubs = preg_replace( "/background-color(.*?;)/mi", "background-color: #{$r['td_color2']}; color: {$r['fontcolor3']};", $mkpsubs);
$css = preg_replace( "`(.importforms(.*?}))`is", $mkpsubs, $css);
}
// Not Good !!importing table font formatting
$pos = strpos($css2, ".gen,.genmed,.gensmall");
$pos2 = strpos($css2, "}", $pos);
if ($pos) {
$mkpsubs = substr($css2, $pos, ($pos2 - ($pos -1)));
$mkpsubs = preg_replace( "/color(.*?;)/mi", "color: #{$r['body_text']};", $mkpsubs);
$css = preg_replace( "`(.importfont(.*?}))`is", $mkpsubs, $css);
}
//importing hyperlink a:link style
$pos = strpos($css2, "a:link");
$pos2 = strpos($css2, "}", $pos);
if ($pos) {
$mkpsubs = substr($css2, $pos, ($pos2 - ($pos -1)));
$mkpsubs = preg_replace( "/color(.*?;)/mi", "color: #{$r['body_link']};", $mkpsubs);
$css = preg_replace( "`(.importlink(.*?}))`is", $mkpsubs, $css);
}
//importing hyperlink a:visited style
$pos = strpos($css2, "a:visited");
$pos2 = strpos($css2, "}", $pos);
if ($pos) {
$mkpsubs = substr($css2, $pos, ($pos2 - ($pos -1)));
$mkpsubs = preg_replace( "/color(.*?;)/mi", "color: #{$r['body_vlink']};", $mkpsubs);
$css = preg_replace( "`(.importvisited(.*?}))`is", $mkpsubs, $css);
}
//importing hyperlink a:hover style
$pos = strpos($css2, "a:hover");
$pos2 = strpos($css2, "}", $pos);
if ($pos) {
$mkpsubs = substr($css2, $pos, ($pos2 - ($pos -1)));
$mkpsubs = preg_replace( "/color(.*?;)/mi", "color: #{$r['body_hlink']};", $mkpsubs);
$css = preg_replace( "`(.importhover(.*?}))`is", $mkpsubs, $css);
}
//adjust images path
$css = str_replace("url(images", "url($images_url", $css);
$css = str_replace ("MKPORTALIMGDIR", "$mklib->images", $css);
$css = "<style type="text/css">n$cssn</style>n";
unset($css2);
return $css;
}
And then there is the skinners who do not use any default phpBB css classes at all. The MKPortal importing functions will not work at all with these skins. At that point it is better to just create a matching MKPortal skin.













