0

我不知道如何在这段代码中中断,所以下面这段代码中的下巴图像以垂直格式显示多个图像(而不是水平并排显示它们)。因为图像很宽,如果我水平显示它们会占用很多空间?我的编码知识很基础,所以如果你能告诉我具体的位置,那将非常有帮助.. :)。我也不确定是否应该使用分页符

或 a
, span 或其他。

                    // Hack for jAwards integration, displays some medals of the user for Kunena 1.6
                $number_medals = 10;  // number of medals to show
                $query = "SELECT b.image, b.name"
            . "\n FROM #__jawards_awards AS a"
            . "\n LEFT JOIN #__jawards_medals AS b ON b.id = a.award"
            . "\n WHERE a.userid=". $this->profile->userid
            . "\n ORDER BY RAND() LIMIT ".$number_medals;

        $database = &JFactory::getDbo(); 
        $database->setQuery( $query );
                $medals = $database->loadObjectList();

                // URL links to the jAwards-Tab for Community Builder which displays all
                // medals of the user - change to another URL of needed
                $awards_url=JRoute::_('index.php?option=com_comprofiler&task=userProfile&user='.$this->profile->userid."&tab=getawardstab");

                // CSS-class "ja_medals" allows individual styling of medal images and
                // container. "nobr" keeps the medals from breaking apart, display them 
                // in one row.
                $msg_jawards = "<div class=\"ja_medals\"><nobr>";
            foreach ($medals as $med){
        $msg_jawards.= "<a href=\"$awards_url\" title=\"$med->name\">" 
            . "<img style='border:0px;padding:0px;' src=\"".KUNENA_JLIVEURL."/images/medals/".$med->image ."\" alt=\"".$med->name."\" />"
            . "</a>";    
        }

        $msg_jawards.="</nobr></div>";
        unset($medals);
        echo $msg_jawards;

?>
4

3 回答 3

2

<br/>像这样在图像之间添加:

<img src="..." />
<br />
<img src="..." />
于 2013-02-12T05:48:17.183 回答
1

从代码中删除<nobr>标签并在样式表文件中添加以下行

.ja_medals img { display: block; }
于 2013-02-12T07:22:48.090 回答
0

$msg_jawards.= "name\">" . "image ."\" alt=\"".$med->name."\" />" . "
"; 把 <BR /> 标签放在最后。或者将您的图像放在 P 标签中

于 2013-02-12T05:49:15.753 回答