Applying Themes(CSS) To Web Site

i have to apply selected theme to the whole website

Page 1 of 1

6 Replies - 1049 Views - Last Post: 24 March 2009 - 03:06 PM Rate Topic: -----

#1 pavan2mnp   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 23-March 09

Applying Themes(CSS) To Web Site

Posted 23 March 2009 - 02:33 AM

hi friends,
My requirement is i have to apply the user selected Theme(css) to the whole website like gmail or orkut Themes with out refreshing the page also.please help me out.


Thanks in advance.
Is This A Good Question/Topic? 0
  • +

Replies To: Applying Themes(CSS) To Web Site

#2 TMKCodes   User is offline

  • D.I.C Regular
  • member icon

Reputation: 48
  • View blog
  • Posts: 440
  • Joined: 21-March 09

Re: Applying Themes(CSS) To Web Site

Posted 23 March 2009 - 03:22 AM

You can use PHP and html form to do that.
Was This Post Helpful? 0
  • +
  • -

#3 pavan2mnp   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 23-March 09

Re: Applying Themes(CSS) To Web Site

Posted 23 March 2009 - 03:49 AM

View PostTMKCodes, on 23 Mar, 2009 - 02:22 AM, said:

You can use PHP and html form to do that.


The css(Theme) is applying when i press only refresh(F5) button and the page is getting refresh. How can i solve these 2 problems.
Was This Post Helpful? 0
  • +
  • -

#4 Valek   User is offline

  • The Real Skynet
  • member icon

Reputation: 544
  • View blog
  • Posts: 1,713
  • Joined: 08-November 08

Re: Applying Themes(CSS) To Web Site

Posted 23 March 2009 - 02:22 PM

How are you currently applying the CSS?
Was This Post Helpful? 0
  • +
  • -

#5 Lemons   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 23-March 09

Re: Applying Themes(CSS) To Web Site

Posted 23 March 2009 - 03:38 PM

View Postpavan2mnp, on 23 Mar, 2009 - 02:49 AM, said:

View PostTMKCodes, on 23 Mar, 2009 - 02:22 AM, said:

You can use PHP and html form to do that.


The css(Theme) is applying when i press only refresh(F5) button and the page is getting refresh. How can i solve these 2 problems.


Sounds like a problem from AJAX and JS.

As far as i know, i don't think PHP can dynamically refresh a page, but i don't know everything.
Was This Post Helpful? 0
  • +
  • -

#6 pavan2mnp   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 23-March 09

Re: Applying Themes(CSS) To Web Site

Posted 23 March 2009 - 07:43 PM

View PostValek, on 23 Mar, 2009 - 01:22 PM, said:

How are you currently applying the CSS?



Iam saving the themes(css) in database. In one phppage(form) i will display thumb nails of these themes by fetching from database. when ever user selects the particular theme(css) by clicking on the specific thumb nail , the theme has to get apply. Exactly like gmail.
Was This Post Helpful? 0
  • +
  • -

#7 RPGonzo   User is offline

  • // Note to self: hmphh .... I forgot
  • member icon

Reputation: 151
  • View blog
  • Posts: 954
  • Joined: 16-March 09

Re: Applying Themes(CSS) To Web Site

Posted 24 March 2009 - 03:06 PM

*EDIT*
After re-reading your original post ( i was not fully paying attention sorry :( ) this may or may not help ... but yea ... just realized you don't want to refresh
*END EDIT*


you could always use a quick JS clip and do a page refresh onclick of your thumbnail images.

<a href="java script:location.reload(true)">[THUMBNAILIMAGE]</a>



another idea is you can actually write your CSS code in a PHP file and just use a switch or something similar to pull the defined CSS into the head section of your page. That way your only storing a "variable" as to which section of CSS you are using thus minimizing the amount of data having to be pulled from the database.

so you would have

CSS.PHP 

<?php
header("Content-type: text/css");

switch($my_CSS) {

case '1':

	 echo "CSS"
  break;

case '2':

	 echo "CSS"
  break;
}
?>



than for your database pull just use like

<?php

// if you have a user login system if not than use a differnt variable and where clause
$sql = "SELECT Theme_ID FROM mydatabase WHERE username='$username'";
$res = mysql_query($sql) or die('Error, query failed: '.mysqlerror());
$val = mysql_fetch_array($res);

$my_CSS = $val['Theme_ID']
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

	<head>
				<meta http-equiv="Content-Language" content="en-us"/>
		<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
			   <link rel="stylesheet" type="text/css" media="screen" href="CSS.PHP">
		</head>

"ETC............"



Just ideas hope it helps ;)

This post has been edited by RPGonzo: 25 March 2009 - 07:15 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1