vBulletin Dynamic Style Loading

ravish.tiwari

New Member
hello everyone,

I've added some custom code to dynamically load stylesheets, like the 1 in vBulletin.com, I can't use vBulletin styles because I've customized the templates a lot.

tell me tell you how my custom script works,
when user clicks on any option, I load the stylesheet using Javascript toolkit and store the user preference into database. I have customized footer template for this.

till here everthing is working fine,

now the problem part:

now I've user's preferred style option in database.

but when user goes to a different page(or refresh the page), the changes are lost.
I tried to load the style by using this code: (in the footer)
but it isn't working:

PHP:
$sql_check="select count(*) as cnt from userstyles where userid='".$vbulletin->userinfo['userid']."';";
	$count=$db->query_read($sql_check);
	$data=mysql_fetch_array($count);
	if($data['cnt']>0)
	{
		$sql="select * from userstyles where userid='".$vbulletin->userinfo['userid']."';";
		$rs=$db->query_read($sql_check);
		$data_style=mysql_fetch_array($rs);
	
		echo '<script type="text/javascript">';
		echo "var css = new Asset.css(".$data_style['stylelocation'].", { });</script>	";

	}

please help me :(
 
Back
Top