MyBB Community Forums

Full Version: caching a new stylesheet
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

below you can see some lines of the activate-function of one of my plugins. Everything is working well but not the caching of the new stylesheet. I would be glad if anyone can show me the way how the stylesheet can or will be cached.

	$css = array(
		"name" => "mynewstylesheet.css",
		"tid" => 1,
		"attachedto" => "usercp.php|mypluginname.php",
		"stylesheet" => "blablabla",
        "cachefile" => $db->escape_string(str_replace('/', '', mynewstylesheet.css)),
		"lastmodified" => TIME_NOW
	);

	require_once MYBB_ADMIN_DIR."inc/functions_themes.php";

	$sid = $db->insert_query("themestylesheets", $css);
	$db->update_query("themestylesheets", array("cachefile" => "css.php?stylesheet=".$sid), "sid = '".$sid."'", 1);

	$tids = $db->simple_select("themes", "tid");
	while($theme = $db->fetch_array($tids))
	{
		update_theme_stylesheet_list($theme['tid']);
	}

Thank you in advance.
The function resync_stylesheet had worked for me Wink
Thank you for your answer, Jones. I have tried this as well by using it right after "update_theme_stylesheet_list($theme['tid']);" but it didn't work... Undecided