How to modify CSS with PHP?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • deko

    #16
    Re: How to modify CSS with PHP?

    How do I set the width of that combo box??

    got it...

    <select style="width: 180px" name=color onChange="bgcol or.submit()">

    Comment

    • Satya

      #17
      Re: How to modify CSS with PHP?


      hello
      You can give your css file extension php and do what you want with them
      like a php file.

      like
      ..table1 {
      width:<?=$urVar ;?>
      }

      and include this file in <style .....>
      Ok.

      Bye

      Comment

      • deko

        #18
        Re: How to modify CSS with PHP?

        You can give your css file extension php and do what you want with them
        like a php file.
        >
        like
        .table1 {
        width:<?=$urVar ;?>
        }
        >
        and include this file in <style .....>
        I didn't know that. So in the <headsection of my page, would I use something
        like this:

        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>my page with dynamic css</title>
        <link href="http: // www . example . com/style.css" rel="stylesheet "
        type="text/css"//for regular css
        <style>
        "http: // www . example . com /style.php"//for dynamic css
        </style>
        </head>

        Does that look correct?

        Comment

        • Adam

          #19
          Re: How to modify CSS with PHP?

          On Wed, 23 Aug 2006 12:26:17 -0700, deko wrote:
          >>How do I get it to stick with the user's choice on post back? Do I have to
          >>grab
          >>that value with PHP code and then set the combo default manually? How?
          >>
          >Yes, you will need to set the selected option manually.
          >Try something like this:
          >>
          ><form name="bgcolor" action="http: // www . example . com/ks123/?p=85"
          >method="post ">
          > <select name=color onChange="bgcol or.submit()">
          > <option value=white
          ><?=($_POST['color']=='white'?'sele cted':'')?>>whi te</option>
          > <option value=yellow
          ><?=($_POST['color']=='yellow'?'sel ected':'')?>>ye llow</option>
          > </select>
          ></form>
          >
          >Unfortunatel y, I cannot do that in my current situation, but thanks for the tip.
          >I may use that elsewhere.
          Just to add to this thread - that I occasionally use PHP to get the
          browser version (in case JS is turned off) so that I can import
          different sets of (accordingly tweaked) stylesheets. It's a bit of a
          kludge though, I think.

          Adam.

          Comment

          • deko

            #20
            Re: How to modify CSS with PHP?

            Just to add to this thread - that I occasionally use PHP to get the
            browser version (in case JS is turned off) so that I can import
            different sets of (accordingly tweaked) stylesheets. It's a bit of a
            kludge though, I think.
            Sounds interesting. How do you get the browser info with PHP?

            I liked Satya's suggestion:
            You can give your css file extension php and do what you want
            with them like a php file.
            like
            .table1 {
            width:<?=$urVar ;?>
            }
            and include this file in <style .....>
            I assume it would look something like this:

            <head>
            <meta ... >
            <title ... >
            <style>

            </style>
            </head>

            I haven't tried this yet, but I assume the idea is to use $_GET in style.php.

            I have a form on a page with a select drop-down that posts a 'color' value that
            changes the page background color - the value resets to 'change background' (or
            null) after postback. The problem is I want to add a couple of links: "normal
            font" and "large font", in addition to the select background option. But if the
            user clicks one of these links, the page reloads with a null post variable and,
            if a background color was previously selected, it's lost after selecting the
            font size.

            Because the select option resets to null after the postback, I have no way of
            knowing what the user had selected (if anything). So I'm not sure if a
            style.php file is going to help me. And I'm not sure I want to deal with page
            state just to include those font size links.

            Comment

            Working...