views:

89

answers:

2

Hi, I have a section like

$myresult .= '<tbody>';
/*start printing the table wth feature and ratings */
for ($i = 1 ; $i < $numProperties; $i++){
  if($master_rating_properties['rating'.$i.'_name']){
    $myresult .= '<tr>';
    $myresult .= '<td width=\'22%\'>';
    $indfeature = 0;
    $indfeature = $row_product['property'.$i.'_avg'];
    $myresult .= $master_rating_properties['rating'.$i.'_name'].' ( '.$indfeature .')';
    $myresult .= '</td>';
    $myresult .= '<td colspan=\'0\' width=\'38%\' >';
    $tocheck = $indfeature;
    for($k = 0.5; $k <= 10.0; $k+=0.5){
      $tocheck = roundOff($tocheck);
      if(($tocheck) == $k) {
        $chk = "checked"; 
      } else { 
        $chk = ""; 
      }
      $myresult .= "<input class='star {split:2}' type='radio'";
      $myresult .= " name='drating$i' id='drating$i$k' value='$k'  '$chk'";
      $myresult .= " title='$k out of 10' disabled '/>";
    }
    /* for k loop end */
    /* added later ,was missing */
    $myresult .= '</td>';
    $myresult .= '</tr>';
  }
  /* end if loop */
}
/* end i for loop */
$myresult .= '</tbody>';
/* end tbody */    

it works fine like printing the 10 stars(radio buttons) horizontally . but many a time all the 10 stars turn vertical.and after few browser refreshes it comes back to horizontal position. any idea .y this is causing problem? does tbody tag cause some problem.

i have done a demo page here. but its different form the code posted. that page i reverted back to old code. so posted this demo link to another page where this happens

http://ratingscorner.com/tempcollege . here also stars appears vertically sometimes.

A: 

http://www.smarty.net/ preferred: http://alexeyrybak.com/blitz/blitz_en.html

Tobias
php itself is a good template engine too
Col. Shrapnel
A: 

First a question. why are you using tables to display layout? tables are for tabular data.

Given that you did not post the html, I am going to have to base this on a guess. I am guessing that the width 38% is not wide enough for the width of the 10 stars. so change that width to:

(width of star image) * 10 -> in pixels

and if you have any padding/margin/border/etc on the images, you will need to adjust the width accordingly.

edit:

Ok, I see it now. The problem is from a naughty div and a elements. The javascript does some fandangling to work around the IE box model problem... and the code is obviously screwing up. On reload, the javascript is telling the < div > tags to have a width of 85px and the < a > tags inside those div's to have a margin of -85px.

I recommend going to the google code page for that javascript and discussing this problem with them.

http://code.google.com/p/jquery-star-rating-plugin/

revil
@revil - okie i take your words. say a certain block it happens like this. but where ever there are stars in the page, it becomes vertical. so you mean to say every where there is width problem? and display: block statement cause this problem by any chance?
pradeep
I cannot reproduce the error. what browser are you viewing this in and what do you have to do to see the problem?
revil
@revil - i use FF. i just refresh the screen and it happens . hope u have seen my latest link that i have posted ratingscorner.com/tempcollege
pradeep
@pradeep: can't really see the error in FF, no matter how many time I refresh...
nico
pradeep
That was nico, not me... I updated my answer though. it is most likely a problem with the javascript as in there is a bug with it. You will get better support from the creators of the js.http://code.google.com/p/jquery-star-rating-plugin/
revil
@revil - hey i updated the js with the latest version as i had a 1 version older js file. now i tried to refresh 2-3 times . the vertical tabs did not happen. hey check from your side once , i wanna make sure that its not happening. thanks for all help.
pradeep
Yup, seems to be working nicely now. Bravo.
revil
ah, if you wanna be nice, accept my answer and give me some reputation! :p
revil
@revil - i will do tht :)
pradeep
@revil - i had same problem with another section also.the question was at http://stackoverflow.com/questions/2808359/how-to-dynamically-show-hide-rows-in-a-table if u can provide some help. it will be greatfull.
pradeep