我不知道如何在这段代码中休息,所以下面这段代码中的jaward图像以垂直格式显示多个图像(而不是水平并排显示)。因为图像很宽,如果我水平显示它会占用很多空间吗?我的编码知识是基本的,所以如果你能告诉我具体的位置,那将是非常有帮助的.. :)。我也不确定是否应该使用分页符
或者一个,或者其他。
// 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;
?>
答案 0 :(得分:2)
在图片之间添加<br/>
,如下所示:
<img src="..." />
<br />
<img src="..." />
答案 1 :(得分:1)
从代码中删除<nobr>
代码,并在样式表文件中添加以下行
.ja_medals img { display: block; }
答案 2 :(得分:0)
$ msg_jawards。=“name \”&gt;“
。 “image。”\“alt = \”“。$ med-&gt; name。”\“/&gt;”
。 “
”;
把&lt; BR /&gt;标签在最后。
或将您的图像放入P标签