Latest news from Xavier Media
It is currently Sun Dec 08, 2013 12:24 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: CSS and PHP local variables can't be accessed?
PostPosted: Fri Oct 23, 2009 7:52 am 
Offline
Rookie (I'm probably spamming)
Rookie (I'm probably spamming)

Joined: Fri Oct 23, 2009 1:30 am
Posts: 2
Points: 0
<?php header("Content-type: text/css");
$backgroundcolor = "#EE7600";
$textcolor = " #0033FF";
?>
body {
background:<?php echo $backgroundcolor;?>;
color:<?php echo $textcolor?>;
}

I want to be able to change the values assigned to $backgroundcolor = "#EE7600"; and $textcolor = " #0033FF"; on another script and give them new values in terms of color for each one variable.
For example, giving $textcolor = " #0022HH"; a new value of "#0022HH" on another script.

Currently the variables work fine for static unchanging colors for the font and background, but how do I fix the variables so that I can give them different values when called from another script.

I tried making the variables global but that did not work, any ideas, someone was telling me this is impossible with CSS and php and that I needed Java script...


Report this post
Top
 Profile Send private message E-mail  
Reply with quote  
 Post subject: Re: CSS and PHP local variables can't be accessed?
PostPosted: Fri Oct 23, 2009 3:37 pm 
Offline
XavierForum.com Admin
XavierForum.com Admin
Super VIP Member
Super VIP Member
User avatar

Joined: Tue Mar 15, 2005 4:37 pm
Posts: 1082
Location: Sweden
Points: 1500
Something like this perhaps:
Code:
<?php header("Content-type: text/css");
if (!isset($backgroundcolor))
{
     $backgroundcolor = "#EE7600";
}
if (!isset($textcolor))
{
     $textcolor = " #0033FF";
}
?>
body {
background:<?php echo $backgroundcolor;?>;
color:<?php echo $textcolor?>;
}

_________________
Xavier Media®
Join me at LinkedIn | Get your latest blog post in your signature you too


Report this post
Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Registered users: No registered users


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Portal » Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
[
SEO MOD © 2007 StarTrekGuide ]