How to create divs dynamically?

I want to populate a div with with other divs inside, the inside divs will need to be created dynamically though. Would anyone be so kind as to show me a quick code example? Either that or suggest another way of rendering the data. What I’m trying to do is, display all user names logged into a particular room. At the moment I’m just printing their names in plain text in a <p> with <b/> after each name. I’d need to be able to color certain divs depending on certain conditions. Make sense?

do not understand your requirements :lol:




         class MyXXX extends CWidget{


             public $someVar;


             public function run(){

                      $this->render('xxx');


                }

          }

        // in your views/xxx.php 


        <?php   if($someVar == $xx): ?>

             some div output 

                      

        <?php endif;  ?> 




      <?php   if($someVar == $yy): ?>

             some div output 

                      

        <?php endif;  ?> 




in browser end , you may want do this :




          <div id='xx'>

            <script type="text/javascript" >

                $("#xx").load('someUrl');

             </script>

          <div>






actually i am not clear what you want to do :-[

It’s ok I figured it out, sorry for the ambiguous explanation, and thanks for taking the time to help me out.