Skip to main content

Forums

This topic contains 10 replies, has 0 voices, and was last updated by  Htmlmainiac 6 years, 3 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #41528

    Htmlmainiac
    Member

    I am running a wordpress site [here](http://bochdewi.co.uk/htmlmainia) and im trying to run php in the style.css with .htaccess but its not working.

    #118600

    chrisburton
    Participant
    #118606

    chrisburton
    Participant

    @htmlmainiac Can we see your style.css file?

    Edit: Oops. I meant your .htaccess file.

    It seems it’s working since I see styling on your site. What’s not working for you?

    #118607

    chrisburton
    Participant

    Try adding this piece of code in place of yours at the top of your style.css file.

    < ?php
    header(“Content-type: text/css; charset: UTF-8”);

    $noUnderline = “none”;
    ?>

    And then right outside the closing PHP tag (?>), place this:

    a {text-decoration: < ?php echo $noUnderline; ?>;}

    #118727

    chrisburton
    Participant

    I don’t see any PHP. PHP shouldn’t output as PHP unless there’s an error in your code. Is the htaccess file in the same place as your style.css?

    #118745

    DustinWoods
    Member

    I’ve found a couple ways to do this. You can either tell your server to rewrite a *.css request to look at a PHP script (such as “style.php?name=style”). The other way you can do this is by configuring .css files to be handled by php. I think this .htaccess code should work:


    php_value default_mimetype "text/css"

    Make sure this .htaccess is at least in the same directory as your css php script.

    #118830

    chrisburton
    Participant

    @Htmlmainiac Can you at least answer our questions while ignoring some of our solutions?

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

icon-link icon-logo-star icon-search icon-star