dynamically loading css-rules!

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Re: dynamically loading css-rules!

    what is the question, I dont get it, you said it print correctly the styles,
    so what's the problem ?

    Savut

    "Sindre Hiåsen" <paalhi@ifi.uio.no> wrote in message
    news:opr8afqo0vomjd1h@news.online.no...
    > Hi,
    >
    > I am trying to load the css rules dynamically with php. The rules is
    > inside mySQL and looks like this one:
    > .20 {
    > font-family: Verdana, Arial, Helvetica, sans-serif;
    > font-size: 30px;
    > }
    > .
    > Here is the interesting part of the html code:
    > $numCss = count($cssRule);
    >
    > for($i=0;$i<$numCss;$i++)
    > {
    > print $cssRule[$i]; //Test to see exactely what is printed out
    > }
    >
    > ?>
    >
    > <html>
    > <head>
    > <title>page</title>
    > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    > <style type="text/css">
    > <!--
    > <?php
    > for($i=0;$i<$numCss;$i++)
    > {
    > print $cssRule[$i];
    > }
    >
    > ?>
    > -->
    > </style>
    > </head>
    > <body>
    >
    >
    > <table width="100%" height="100" border="0" cellspacing="0"
    > cellpadding="0" rules="none" frame="void">
    > <tr>
    > <td height="80" colspan="8" bgcolor="#0000ff" class="20">Text</td>
    > </tr>
    > </table>
    >
    > and this is the actually print out from the test loop
    >
    > .336 {
    > font-family: "Times New Roman", Times, serif;
    > font-size: 14px;
    > font-weight: bold;
    > color: #0000ee;
    > text-align: center;
    > }
    > .337 {
    > font-family: Verdana, Arial, Helvetica, sans-serif;
    > font-size: 20px;
    > font-weight: bold;
    > text-align: center;
    > }
    > .20 {
    > font-family: Verdana, Arial, Helvetica, sans-serif;
    > font-size: 30px;
    > }
    >
    > And there are no errors inside this rules because if I paste this inside
    > the style tag's as plane text all works perfectly fine.
    >
    > Why cant I print out the css rules dynamically this way?
    > There is nothing wrong in this though
    >
    > <?php
    > print <<<END
    > .20 {
    > font-family: Verdana, Arial, Helvetica, sans-serif;
    > font-size: 30px;
    > }
    > END;
    > ?>
    >
    > but what's the point? I need to print out the array.
    >
    > Someone!
    >
    > regards,
    >
    > Sindre
    Savut Guest

  2. Similar Questions and Discussions

    1. Dynamically loading xml content
      I?m creating a menu bar in which the links have to be dynamically created based on the values in the xml, and the number of links(buttons) may even...
    2. Dynamically loading PNG and GIF files through XML
      Hello, I have a project where I need to use XML to dynamically load PNG and GIF files not just JPEGs. I have found forums and information from...
    3. Loading images dynamically
      I have a slideshow that I am working on and the way the slideshow works is that it assigns any number of images i define to an array. problem is,...
    4. Dynamically Loading UI Components in MX 2004 Pro
      Hello, I was wondering how to load the UI components like (RadioButton, Checkboxes, etc) dynamically at runtime. I was fooling around and...
    5. dynamically loading video
      hi flashbrains, anyone know if its possible to dynamically load a video file into a flash movie? i want to have the my SWF reading a text file to...
  3. #2

    Default dynamically loading css-rules!

    Hi,

    I am trying to load the css rules dynamically with php. The rules is
    inside mySQL and looks like this one:
    ..20 {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 30px;
    }
    ..
    Here is the interesting part of the html code:
    $numCss = count($cssRule);

    for($i=0;$i<$numCss;$i++)
    {
    print $cssRule[$i]; //Test to see exactely what is printed out
    }

    ?>

    <html>
    <head>
    <title>page</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    <?php
    for($i=0;$i<$numCss;$i++)
    {
    print $cssRule[$i];
    }

    ?>
    -->
    </style>
    </head>
    <body>


    <table width="100%" height="100" border="0" cellspacing="0"
    cellpadding="0" rules="none" frame="void">
    <tr>
    <td height="80" colspan="8" bgcolor="#0000ff" class="20">Text</td>
    </tr>
    </table>

    and this is the actually print out from the test loop

    ..336 {
    font-family: "Times New Roman", Times, serif;
    font-size: 14px;
    font-weight: bold;
    color: #0000ee;
    text-align: center;
    }
    ..337 {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    }
    ..20 {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 30px;
    }

    And there are no errors inside this rules because if I paste this inside
    the style tag's as plane text all works perfectly fine.

    Why cant I print out the css rules dynamically this way?
    There is nothing wrong in this though

    <?php
    print <<<END
    ..20 {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 30px;
    }
    END;
    ?>

    but what's the point? I need to print out the array.

    Someone!

    regards,

    Sindre
    Sindre Hiåsen Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139