Theme Selection

Started on the old forum in February 2007 · view the original in the archive · old links redirect here

3 replies · 695 views · started 19 years ago · 1 min read

2 participants
wizard Senior · 493 posts #1

in my script im trying to get users to select their theme. this is my coding

function meta()
{
$usr = getuid_sid($sid);
  $theme = mysql_fetch_array(mysql_query("SELECT theme FROM fun_members WHERE id='".$usr."'"));
  if($theme)
  {
    $usertheme = "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0].css\" />";
  }else{
 $usertheme = "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/style.css\" />";
}

echo "$usertheme";

?>

when users select the theme it updates in the database this doesnt happen

$usertheme = "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0].css\" />";

can some1 tell me what i did wrong please

blackhowk Senior · 411 posts #2

in my script im trying to get users to select their theme. this is my coding

function meta()
{
$usr = getuid_sid($sid);
  $theme = mysql_fetch_array(mysql_query("SELECT theme FROM fun_members WHERE id='".$usr."'"));
  if($theme)
  {
    $usertheme = "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0].css\" />";
  }else{
 $usertheme = "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/style.css\" />";
}

echo "$usertheme";

?>

when users select the theme it updates in the database this doesnt happen

$usertheme = "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0].css\" />";

can some1 tell me what i did wrong please

here is one example:

// conect to database here

$sql = "SELECT theme FROM fun_members WHERE id='".$usr."' "; $result = mysql_query($sql); $row = mysql_fetch_array($result); $theme = $row['theme']; echo "<link href="css/".$row['theme']."" rel="stylesheet" type="text/css" />";

if a new member was registered INSERT INTO theme some default name (default.css)

wizard Senior · 493 posts #3

here is one example:

// conect to database here

$sql = "SELECT theme FROM fun_members WHERE id='".$usr."' "; $result = mysql_query($sql); $row = mysql_fetch_array($result); $theme = $row['theme']; echo "<link href="css/".$row['theme']."" rel="stylesheet" type="text/css" />";

if a new member was registered INSERT INTO theme some default name (default.css)

what if the user is not logged in, then there wont be no stylesheet would there. thnx anyway

blackhowk Senior · 411 posts #4

what if the user is not logged in, then there wont be no stylesheet would there. thnx anyway

if the user is not logged mysql store the last name of the stylesheet.

yes if the user is registered and dont have one visit the style must be default for the next first visit.

or you dont have to keep in your database some "settings"?

-with pleasure.

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close