#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Norcross, GA
    Posts
    458
    Rep Power
    14
    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!
  2. #2
  3. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    6
    Rep 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.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Norcross, GA
    Posts
    458
    Rep Power
    14
    Good suggestions, but unfortunately no dice.

    The color will change, but not the font size.
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Posts
    1
    Rep 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!
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Norcross, GA
    Posts
    458
    Rep Power
    14

    .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*

  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Norcross, GA
    Posts
    458
    Rep Power
    14
    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!

IMN logo majestic logo threadwatch logo seochat tools logo