CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 15th, 2001, 09:45 PM
Smoking Joe Smoking Joe is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Posts: 4 Smoking Joe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi everybody,
I'm new in this forum..
I got a problem can u guys help me??

I'm trying to make a control panel for my guestbook. Therefore I wanna modify the font and css, I insert the font face and css into the datebase...

and the font face and css were linked, which was like this ".text {text-decoration: none; color: $fontcolor; font-family: $font; font-size: 9pt}"

but when I called it out, the css didn't work, so I read the source code from ie.....I can only see ".text {text-decoration: none; color: $fontcolor; font-family: $font; font-size: 9pt}"....can somebody tell how to do it??

Reply With Quote
  #2  
Old April 15th, 2001, 10:42 PM
caguru's Avatar
caguru caguru is offline
<insert title here>
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: at home
Posts: 405 caguru User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 29 m 59 sec
Reputation Power: 13
I am guessing you are trying to add an inline style declaration inside your html. I could see how that would make changes easier but I really suggest using external style sheets over db. There might be a reason for your idea, so i will leave it alone. I also have two suggestions.
My first which is my personal preference is to create one external sheet that is applied to all pages. All you have to do is add a link tag in the head of your html like so:
<link rel="stylesheet" href="styles.css">
then you have one style sheet that is applied to all pages. Then theres the other way.
And there is nothing wrong with your css. It's your PHP, database. If you don't see your variables inside the source window the code didn't execute correctly. Try posting the actual PHP if you can't figure it out. Sometimes it is easier for someone who is not frustrated about it to find the problem. If your code is working than you will see:

.text {text-decoration: none; color: #660; font-family: #360; font-size: 9pt}
instead of
text {text-decoration: none; color: $fontcolor; font-family: $font; font-size: 9pt}"
in your source window. And if you didn't add the quotes here for the post they need to be escaped inside <? ?>tags like so \" or the PHP engine try to parse what's inside.
__________________
--the key to life is avoiding death--

Reply With Quote
  #3  
Old April 15th, 2001, 10:50 PM
Smoking Joe Smoking Joe is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Posts: 4 Smoking Joe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi,
thx for replying...^^
let me write more detail...

I wrote this in the php code...

$getdata = "SELECT * FROM modify";
$getdata_result = mysql_query($getdata) or die("WRONG");
$row = mysql_fetch_array($getdata_result);
$font = $row["font"];
$fontcolor = $row["fontcolor"];
$css = $row["css"];

the above data were selected from the data base...
and then in the index.php
I wrote....

<style type="text/css">
<?echo $css ?>
</style>

But when I checked the source code from IE.....
I only saw

<style type="text/css">
.text {text-decoration: none; color: $fontcolor; font-family: $font; font-size: 9pt}
</style>

it seems like the php code hasn't been processed..>.<

Last edited by Smoking Joe : April 15th, 2001 at 10:54 PM.

Reply With Quote
  #4  
Old April 15th, 2001, 11:14 PM
caguru's Avatar
caguru caguru is offline
<insert title here>
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: at home
Posts: 405 caguru User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 29 m 59 sec
Reputation Power: 13
I just tried this out:

<html><?php
$font = "tahoma";
$fontcolor = "red";
$css = ".text {text-decoration: none; color: $fontcolor; font-family: $font; font-size: 9pt}";

?>

<style type="text/css">
<?echo $css ?>
</style>


</html>
---------------and it resulted in:

<html>
<style type="text/css">
.text {text-decoration: none; color: red; font-family: tahoma; font-size: 9pt}
</style>


</html>
I am just guessing but I would say from the looks of all this your script is working fine. I might be overlooking something but I think the problem is in your db. Manually check to make sure the values didn't get input as font and fontcolor instead of hex numbers. I think your input script might be the culprit not this one. Let me know if i am wrong.

Reply With Quote
  #5  
Old April 16th, 2001, 08:05 AM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 17
Send a message via AIM to rod k
If the css field in your db references the PHP variables $font and $fontcolor (which from what you are trying to do it appears it does) you'll need to tell PHP to look for them as it won't replace them automatically. Instead of:

$css = $row["css"];

use:

$css= eval($row[css]);
__________________
FSBO (For Sale By Owner) Realty

Reply With Quote
  #6  
Old April 16th, 2001, 02:03 PM
Smoking Joe Smoking Joe is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Posts: 4 Smoking Joe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thank you..!!
I tried "$css= eval($row[css]);"
but it showed "
Parse error: parse error in ../data.php(26) : eval()'d code on line 1"
can u tell wut the problem is??
sorry....I'm not really good at PHP..

Reply With Quote
  #7  
Old April 16th, 2001, 03:00 PM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 17
Send a message via AIM to rod k
That means you have an error in the PHP of the css field.

Reply With Quote
  #8  
Old April 17th, 2001, 02:39 AM
Smoking Joe Smoking Joe is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Posts: 4 Smoking Joe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Strange...
I add this in the php code
"$css = eval($row["css"]);"

and the css code in the database is "BODY {text-decoration: none; color: <?echo $fontcolor ?>; font-family: <?echo $font ?>; font-size: 9pt}"...

it doesn't seems wrong...^^"

Reply With Quote
  #9  
Old April 17th, 2001, 07:52 AM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 17
Send a message via AIM to rod k
You can't use ECHO in it if you want to assign it to a variable. You also don't want the <? ?> tags. Change it to:

BODY {text-decoration: none; color: $fontcolor; font-family: $font ; font-size: 9pt}

Now when the line

$css=eval($row[css]);

is executed, $css will have the value $row[css] EXCEPT that the variables will be replaced with their values at the time the eval() is done, then you can echo $css

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > a Question about php, css and mysql

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap