change text color in php

Discussion in 'PHP' started by irdogg, Aug 10, 2012.

  1. #1
    im trying to change the color of clicks

    $contentlink = " $linktitle (".$contenthits." clicks)";
    Code (markup):
    how can i change the color? thank you :)
     
    irdogg, Aug 10, 2012 IP
  2. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #2
    Change the color for the id of whatever the text is in, in the CSS for that class. Whether it's in an HTML file or a PHP file, color change is done the same way.
     
    Rukbat, Aug 10, 2012 IP
  3. irdogg

    irdogg Well-Known Member

    Messages:
    358
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    135
    #3
    nah that wasnt it solved it! :) thank you!
    $contentlink = "&nbsp;$linktitle <span class=\"linkSilverFont\"> (".$contenthits." clicks) </span>";
    Code (markup):
     
    Last edited: Aug 10, 2012
    irdogg, Aug 10, 2012 IP
  4. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #4
    That's about what I said. Evidently linkSilverFont has color set to the color you wanted.
     
    Rukbat, Aug 10, 2012 IP
  5. seoexposure

    seoexposure Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    It might help you :


    $contentlink = echo '<font color='green'>&nbsp;$linktitle ('.$contenthits.' clicks)</font>';

    Thanks!
     
    seoexposure, Aug 12, 2012 IP
  6. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #6
    @seoExposure -- you do know that FONT has no business in any HTML written after 1998, right?

    My question would be WHY are you making it the color you want, and is it the only element you are doing that to? does it have sibling anchors at it's level and/or a parent you could hook it off of.

    Whenever possible you should AVOID declaring presentation in your markup, since presentation is CSS' job, not HTML's.

    Which is why 'color="green"' or 'span class="silverfont"' is just as outdated and half-assed a way of writing markup as going back to HTML 3.2 (or using the new HTML 5 idiocy).

    But without seeing the actual output from your php -- the HTML itself, it's anyone's guess as to the best way to do what you ask... So far, to be frank what I'm seeing from the other respondents in this thread, that's usually the worst way.

    FONT... Christmas on a cracker, when the blazes are people going to join us in THIS century?
     
    deathshadow, Aug 12, 2012 IP
  7. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #7
    No fair, DS. Due to your sleep schedule, you always beat me. But +1 to your post. The web has more than enough bad code already, we don't need to add any.
     
    Rukbat, Aug 12, 2012 IP