删除 Virtuemart“特色产品”中的空白区域模块

发布于 2024-12-22 07:40:05 字数 2403 浏览 6 评论 0 原文

我在弄清楚如何消除空白时遇到了一些麻烦。我真的不知道我做错了什么,而且我对 html 的了解不够,不知道这是否是问题所在。

附加屏幕截图:

1) 如果我保持代码不变,我的图像将与正下方的模块重叠。 原始代码

2) 如果我修改代码使表格单元格高度为 400px,它会创建大量空白。 修改后的代码高度=400px

“修改代码高度

3) 如果我修改代码以使表格单元格高度为 1-399px,它会创建太多空白或重叠。

修改代码注意:我正在使用“水平”显示样式):

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
    <span style="color:green"><b>> <b></span>Click here to <a href="http://localhost/joomlawebsite/index.php?option=com_content&view=article&id=52"><span style="color:blue"><b>view all featured products</b></span></a>.
</tr>
<?php
$i = 0;
while($db->next_record() ){
    if ($i%2)
    $sectioncolor = "sectiontableentry2";
    else
    $sectioncolor = "sectiontableentry1";

    if( $display_style == "vertical" ) {
    ?>
        <tr align="center" class="<?php echo $sectioncolor ?>">
            <td width="<?php echo $width ?>%">
                <?php 
                $ps_product->show_snapshot($db->f("product_sku"), $show_price, $show_addtocart);
                ?><br />
            </td>
        </tr>
    <?php
    }
    elseif( $display_style== "horizontal" ) {
        if( $i == 0 )
        echo "<tr>\n";
        echo "<td height=\"400px\" width=\"$width%\" align=\"center\">";
        $ps_product->show_snapshot($db->f("product_sku"), $show_price, $show_addtocart);
        echo "</td>\n";
        if( ($i+1) == $db->num_rows() )
        echo "</tr>\n";
    }
    elseif( $display_style== "table" ) {
        if( $i == 0 )
        echo "<tr>\n";
        echo "<td width=\"$width%\" align=\"center\">";
        $ps_product->show_snapshot($db->f("product_sku"), $show_price, $show_addtocart);
        echo "</td>\n";
        if ( ($i+1) % $products_per_row == 0)
        echo "</tr><tr>\n";
        if( ($i+1) == $max_items )
        echo "</tr>\n";
    }
    $i++;
}?></table>

任何帮助将不胜感激。

I'm having some trouble figuring out how to get rid of the whitespace. I really don't know what I'm doing wrong and I don't know enough about html to know if that's the problem.

Screenshots attached:

1) If I leave the code as is, my images overlap with the module directly below.
Original code

Original code with highlights

2) If I modify the code to make the table cell height 400px, It creates a large amount of white space.
Modified code height=400px

Modified code height=400px with highlights

3) If I modify the code to make the table cell height 1-399px, It creates either too much white space or an overlap.

MODIFIED CODE (NOTE: I'm using the "horizontal" display style):

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
    <span style="color:green"><b>> <b></span>Click here to <a href="http://localhost/joomlawebsite/index.php?option=com_content&view=article&id=52"><span style="color:blue"><b>view all featured products</b></span></a>.
</tr>
<?php
$i = 0;
while($db->next_record() ){
    if ($i%2)
    $sectioncolor = "sectiontableentry2";
    else
    $sectioncolor = "sectiontableentry1";

    if( $display_style == "vertical" ) {
    ?>
        <tr align="center" class="<?php echo $sectioncolor ?>">
            <td width="<?php echo $width ?>%">
                <?php 
                $ps_product->show_snapshot($db->f("product_sku"), $show_price, $show_addtocart);
                ?><br />
            </td>
        </tr>
    <?php
    }
    elseif( $display_style== "horizontal" ) {
        if( $i == 0 )
        echo "<tr>\n";
        echo "<td height=\"400px\" width=\"$width%\" align=\"center\">";
        $ps_product->show_snapshot($db->f("product_sku"), $show_price, $show_addtocart);
        echo "</td>\n";
        if( ($i+1) == $db->num_rows() )
        echo "</tr>\n";
    }
    elseif( $display_style== "table" ) {
        if( $i == 0 )
        echo "<tr>\n";
        echo "<td width=\"$width%\" align=\"center\">";
        $ps_product->show_snapshot($db->f("product_sku"), $show_price, $show_addtocart);
        echo "</td>\n";
        if ( ($i+1) % $products_per_row == 0)
        echo "</tr><tr>\n";
        if( ($i+1) == $max_items )
        echo "</tr>\n";
    }
    $i++;
}?></table>

Any help would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝礼 2024-12-29 07:40:05

更改位于 components/com_virtuemart/themes/"yourtemplate"/templates/common/productsnapshot.tpl.php



我将div样式代码更改为:

<div style="height:35px; float:left; width: 100%;line-height:14px;">



我将 div 样式代码更改为:

<div style="width: 100%;float:left">

它去掉了所有不必要的空白

The change is in components/com_virtuemart/themes/"yourtemplate"/templates/common/productsnapshot.tpl.php

Under <!-- The product name DIV. -->

I changed the div style code to this:

<div style="height:35px; float:left; width: 100%;line-height:14px;">

Under <!-- The product image DIV. -->

I change the div style code to this:

<div style="width: 100%;float:left">

And it took away all of the unnecessary white space

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文