The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Web Design
> CSS Help
|
PHP and CSS problem
Discuss PHP and CSS problem in the CSS Help forum on Dev Shed. PHP and CSS problem Cascading Style Sheets (CSS) forum discussing all levels of CSS, including CSS1, CSS2 and CSS Positioning. CSS provides a robust way of applying standardized design concepts to your web pages.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

February 1st, 2001, 03:36 PM
|
|
Contributing User
|
|
Join Date: Aug 2000
Location: Norcross, GA
Posts: 458
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|
The following is an example of what's in a cs.css.phtml style sheet:
p {font-family:arial; font-size: <? echo $sp; ?>pt; color:<? echo $p; ?>}
p.sm {font-family:arial; font-size: <? echo $spsm; ?>pt; color:<? echo $psm; ?>}
p.bbig {font-family:arial; font-size: <? echo $spbig; ?>pt; color:<? echo $pbig; ?>}
There is a table with size and color values for the styles defined above. The color portions work fine, however the size attribute is not working as intended.
When I link to the stylesheet (or include the code directly on the page itself), any p class style is treated as the first p above. In other words, <p class="bbig"> is the same size as <p>, despite having different numerical values.
Someone mentioned before that they had successfully managed to integrate PHP with CSS. I'd like to know if I'm doing this correctly, or if I'm missing something important.
Thanks!
|

February 1st, 2001, 03:55 PM
|
|
Member
|
|
Join Date: Nov 2000
Posts: 6
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Not very experienced with CSS, but syntactically the only difference between your color definitions and size is that there is no space after the colon in
color:<? echo $p; ?> etc. and there is one after the font-size:. Maybe that's the problem. *crosses fingers* Also you don't technically need the semi-colon to end a statement if the "<?" and "?>" are on the same line. Not a big deal, just pointing out.
|

February 1st, 2001, 04:06 PM
|
|
Contributing User
|
|
Join Date: Aug 2000
Location: Norcross, GA
Posts: 458
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|
Good suggestions, but unfortunately no dice.
The color will change, but not the font size.
|

February 1st, 2001, 04:27 PM
|
|
Junior Member
|
|
Join Date: Feb 2001
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
I think the problem may be with your installed fonts and your font-family declaration. Try changing that declaration to "font-family: arial,sans-serif;" and I think that may help you out.
Also, it's usually cleaner to define font sizes in px instead of pt.
If that doesn't work out for you, you may want to double-check that your variables are actually getting assigned.
Hope this helps!
|

February 1st, 2001, 04:28 PM
|
|
Contributing User
|
|
Join Date: Aug 2000
Location: Norcross, GA
Posts: 458
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|
.css page, as parsed by broswer
p {font-family:arial; font-size:8pt; color:black}
p.sm {font-family:arial; font-size:8pt; color:black}
p.big {font-family:arial; font-size:12pt; color:black}
Looks A-OK to me.
.............
I'm testing a seperate phtml document, with only some text and the style sheet.
So far everything is working as it should.
I just substituted php variables for size numbers, and it works. Trying with colors and numbers... that works also. *scratches head*
|

February 1st, 2001, 05:18 PM
|
|
Contributing User
|
|
Join Date: Aug 2000
Location: Norcross, GA
Posts: 458
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|
Problem solved.
I used AddType to make apache parse .css files with php.
That seemed to do it. The external, php equipped style sheet is working like charm now.
Thanks for your input!
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|