1

これが私のコードです

while($row=  mysql_fetch_array($result)) {

                $type = $row[0];
                $user_from = $row[1];
                $operation_to = $row[2];
                $time = $row[3];

                if($type=="vote") {
                    echo self::vote_activity($user_from,$operation_to);

                }
                else if($type=="upload_album") {
//                    echo self::upload_activity($user_from,$operation_to);
                }
                else if($type="create_account") {

                }
                else {

                }
        }

関数投票活動は

function vote_activity($user_from,$operation_to) {
        ob_start();
        global $db;
        $table = "userinformation";
        $data = array("user_id"=>$user_from);
        $result = $db->select($table,$data);
        while($row = mysql_fetch_array($result)) {
            $name = $row[1]." ".$row[2];
        }

        $table = "photo_gallery";
        $data = array("photo_id"=>$operation_to);
        $result = $db->select($table,$data);
        while($row = mysql_fetch_array($result)) {
            $extension = $row[6];
            $user_id = $row[0];
        }

        $source_file_path = basedir."/storage/".$user_id."/".$operation_to.".".$extension;
        $height=200;
        $width=200;
        ?>

            <div class="vote_activity_div" >
                <p class="vote_p"><a><?php echo $name?></a> vote this photo.</p>
                <img class="vote_image" src="Create_thumbnail.php?source_file_path=<?php echo $source_file_path;?>&extension=<?php echo $extension; ?>&height=<?php echo $height; ?>&width=<?php echo $width; ?>"/>
            </div>   
        <?php
        $vote_activity = ob_get_contents();
        ob_clean();
        return $vote_activity;
    }

問題は、ループの最初の投票 div が親 div から出ている間に、この vote_activity クラスを複数回呼び出すとです。

4

1 に答える 1

0

I think your best bet would be to ensure the code is outputting to a parent DIV that has cleared floats etc ensuring there is no escaping. So before you run your script or however it is you are doing this, create a parent div with a class such as vote_activity_parent

I hope this helps!

I think it might be worth adding that you may also need to review your code to ensure it is outputting in the correct places, otherwise your script could be outputting this DIV anywhere which really isn't ideal for control.

于 2012-07-20T23:47:17.413 に答える