Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 CSS/Images
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

PeeWee.Inc
Senior Member

United Kingdom
1893 Posts

Posted - 29 April 2004 :  08:24:17  Show Profile  Visit PeeWee.Inc's Homepage
Anyone know a way i can define where a image dir is within the CSS?

Depending on what CSS is loaded, i need a new image dir to be loaded

De Priofundus Calmo Ad Te Damine

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 30 April 2004 :  08:21:35  Show Profile
Are you using Javascript or VBScript to set the stylesheet? If you're using VBScript and your stylesheets are also in VBScript, you could use a conditional or select case to assign the image directory to a varibale that you can use in your stylesheet.


Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page

PeeWee.Inc
Senior Member

United Kingdom
1893 Posts

Posted - 30 April 2004 :  15:42:14  Show Profile  Visit PeeWee.Inc's Homepage
http://www.web-sn.com/scrpts/skinner/

This is what i've got in use. The same as Image has in use on his site.



var today = new Date();
var expiry = new Date(today.getTime() + 365 * 24 * 60 * 60 * 1000); // 1 year
    
function doSkin(skin) { 
   document.getElementById("skin").href='css/' + skin + '.css';
   document.cookie="skin=" + escape(skin) + "; expires=" + expiry.toGMTString() + "; path=/";
   if (document.all) {// Internet Explorer (and opera too but that's ok)
    var sel = document.getElementsByTagName("SELECT")
    for (i=0;i<sel.length;i++) { // hide and show all select boxes otherwise their colours won't change in IE (GRRRR!!!)
      sel[i].style.visibility = "hidden";
	  sel[i].style.visibility = "visible";
    }
   }
   var nu = navigator.userAgent.toLowerCase();
   var nu2 = (nu.indexOf("opera") != -1);
   if (nu2) {
    // reload for opera, as it doesn't support dynamic css switching
    window.location.reload();
   }

}
 
function drawSkinSelector() {
  if (document.getElementById) { // IE5+, NS6, Opera 6
   str = "";
     str += "<select name=\"skinsel\" onchange=\"doSkin(this.options[this.options.selectedIndex].value)\">";
	 str += "<option value=\"snitz\">Switch Skin</option>";
	 str += "<option value=\"snitz\">Default</option>";
	 str += "<option value=\"snitz1\">snitz</option>";
	 str += "<option value=\"T2\">T2</option>";
	 // add options as desired
     str += "</select>";
  }
  else {
    str = "<img src=\"/images/spacer.gif\">"; // not dom compliant, don't bother.
  }
  document.write(str);

}    

function browserChk() {  // write dumbed-down CSS document for Netscape 4
	var nm = navigator.appName.indexOf("Netscape") != -1;
	var vers = parseInt(navigator.appVersion);
	if (nm && (vers == 4)) {
	  document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/ns.css\">"); 
	}
}


that's the JSript file.

De Priofundus Calmo Ad Te Damine
Go to Top of Page

serritzlev
Junior Member

Denmark
291 Posts

Posted - 01 May 2004 :  02:16:13  Show Profile  Visit serritzlev's Homepage
this in you file, and that is only example to one of that way i use it on my pages.

"<td width=""275""><a href=""../../forum/portal_content.asp""><IMG src=""../style/skin/" + skin + "/logo_snitz_forums_2000.gif"" id=""logo"" alt=""logo - click to go to forum"" border=""0"" width=""275"" height=""100"" hspace=""20""/></a></td>" & vbNewLine & _

And this is your script.
<%
Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../style/" & skin & ".css"" id=""skin"" />" & vbNewline
%>

<SCRIPT language=JavaScript type=text/javascript>
var today = new Date();
var expiry = new Date(today.getTime() + 365 * 24 * 60 * 60 * 1000); // 1 year;
function GoToSkin(skin) {
document.getElementById("skin").href='css/' + skin + '.css';
document.cookie="skin_sp=" + escape(skin) + "; expires=" + expiry.toGMTString() + "; path=/";
window.location.reload();

//---- logo inc_header
document.getElementById("logo").src = "../style/skin/" + skin + "/logo_snitz_forums_2000.gif";

//---- Inc_header.asp
document.getElementById("table_top_left").src = "../style/skin/" + skin + "/table_top_left.gif";
document.getElementById("table_top").src = "../style/skin/" + skin + "/table_top.gif";
document.getElementById("table_top_right").src = "../images/skin/" + skin + "/table_top_right.gif";
document.getElementById("main_top").src = "../style/skin/" + skin + "/main_top.gif";

//---- inc_footer.asp -------->
document.getElementById("main_bottom").src = "../style/skin/" + skin + "/main_bottom.gif";
document.getElementById("table_bottom_left").src = "../style/skin/" + skin + "/table_bottom_left.gif";
document.getElementById("table_bottom").src = "../style/skin/" + skin + "/table_bottom.gif";
document.getElementById("table_bottom_right").src = "../style/skin/" + skin + "/table_bottom_right.gif";


}
</SCRIPT>

Here can you see some example.

http://bpg.sytes.net/SportsForum/portal_content.asp?sectionid=6

http://www.assy.dk/publish/bpg/default.asp

and ofcourse in my forums.


Edited by - serritzlev on 01 May 2004 02:34:23
Go to Top of Page

PeeWee.Inc
Senior Member

United Kingdom
1893 Posts

Posted - 01 May 2004 :  08:55:54  Show Profile  Visit PeeWee.Inc's Homepage
Yeah, i looked into doing that like this. This is the way Image done it, right?


Thing is, i need every image within the forums image dir to be switched when the CSS file is :(

De Priofundus Calmo Ad Te Damine
Go to Top of Page

serritzlev
Junior Member

Denmark
291 Posts

Posted - 01 May 2004 :  11:09:22  Show Profile  Visit serritzlev's Homepage
Nop today image have done this on another way and this is a add to inc_func_common or icon file.

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.33 seconds. Powered By: Snitz Forums 2000 Version 3.4.07