Forum Moderators: martinibuster
I have Google adsense on my site and everything is working perfectly, the problem I need solving is if there is a way of adding multiple themes based on what .css style sheet is in use.
I'm not too canny on Javascript but hear it can be done this way.
For example:
If user has 'GREEN.css' theme selected on my website I want google adsense colors to be...well Greeny in color.
If the user selected the 'BLUE.css' theme selected on my website, then I want my google adsense colors to dynamically change to a Bluey theme.
At the min, I can only choose one set of colors!
I have browsed the forum and saw this post: [webmasterworld.com ]
And wondered if anyone could expand on what jouwpagina says about this:
google_color_bg = "<?
if($style=="black")
echo"000000";
elseif($style=="white")
echo"FFFFFF";
elseif($style=="green")
echo"*******";
?>";
Like I said, its a grey area Javascript to me but if someone could type a script for me to copy and paste, then I could upload it as a .js file
and also edit the google theme script accordingly (Not the code though as I know this is naughty) I would be most greatful.
Thanks
MXMaster
I understand the 'include' function, but my users are switching color schemes on my website by simply switching .css style sheets. I don't have two different web pages for each color theme.
As in:
I don't have 'blue_index.php' and 'green_index.php'
My style sheets look like this:
<link href="../css/css.css" rel="stylesheet" title="none" type="text/css"/>
<link rel="alternate stylesheet" type="text/css" media="screen" title="white-theme" href="../css/white.css" />
Thanks for replying and I wait to hear more...
MX
<? include ("green_index.php")?>
You dont need to call the include files green_index.php etc, I would just call them green_ads.txt or green_ads.php as either will work for what you are doing.
If your pages are not php you have a few options, either in your htaccess file set it so it will parse php on a html page or use ssi to include the file.
I understand the 'include' you have wrote but still can't see how to link this with my .css files?
My webpage uses a Javascript command to 'switch' style sheets at the click of a button without changing the page source code.
So I can click green.css and all my page looks green, or I can click the link to switch the page to blue.css so my page looks blue.
If I insert the 'include' to my page and the user 'switches' style sheets giving a different theme, the same Green_ads.php include will still be there... hence, still look 'green'. Even though the page is now showing the 'blue' style sheet.
See what I mean?
I would love to post the link to the webpage to show you but I can't.
Hope this makes sense.
MX
Maybe you could ask in the css forum
You can sticky me the URL if you want.
I solve this problem the PHP way that was described above. Every css file has a matching PHP include file, with functions like show160x800ad(), show250x250ad(), etc.