如果station显示某些文本,那么要向PHP添加什么?
我在magento中有下面的语句,我想知道我需要添加什么才能让它显示,如果TotalNum等于1,那么它应该只显示文本“item”,而不是“item”如果station显示某些文本,那么要向PHP添加什么?,php,magento,if-statement,Php,Magento,If Statement,我在magento中有下面的语句,我想知道我需要添加什么才能让它显示,如果TotalNum等于1,那么它应该只显示文本“item”,而不是“item” 这应该接近您所需要的 echo ($this->getTotalNum() > 1) 'items' : 'item'; 将其放置在您希望回显单词item或items的位置。这里有一个例子 <p class="amount"> <?php if($this->getLastPag
这应该接近您所需要的
echo ($this->getTotalNum() > 1) 'items' : 'item';
将其放置在您希望回显单词item或items的位置。这里有一个例子
<p class="amount">
<?php if($this->getLastPageNum()>1): ?>
<?php echo $this->__('<span class=search-number>%s</span> items found. Showing %s to %s.', $this->getTotalNum(), $this->getFirstNum(), $this->getLastNum()) ?>
<?php else: ?>
<strong><?php echo $this->__('<span class=search-number>%s</span> ' . ($this->getTotalNum() > 1) 'items' : 'item' . ' found.', $this->getTotalNum()) ?></strong>
<?php endif; ?>
这应该接近您所需要的
echo ($this->getTotalNum() > 1) 'items' : 'item';
将其放置在您希望回显单词item或items的位置。这里有一个例子
<p class="amount">
<?php if($this->getLastPageNum()>1): ?>
<?php echo $this->__('<span class=search-number>%s</span> items found. Showing %s to %s.', $this->getTotalNum(), $this->getFirstNum(), $this->getLastNum()) ?>
<?php else: ?>
<strong><?php echo $this->__('<span class=search-number>%s</span> ' . ($this->getTotalNum() > 1) 'items' : 'item' . ' found.', $this->getTotalNum()) ?></strong>
<?php endif; ?>
您可以使用:
<p class="amount">
<?php if($this->getTotalNum() == 1): ?>
<?php echo $this->__('<span class=search-number>1</span> item found.') ?>
<?php else if($this->getLastPageNum()>1): ?>
<?php echo $this->__('<span class=search-number>%s</span> items found. Showing %s to %s.', $this->getTotalNum(), $this->getFirstNum(), $this->getLastNum()) ?>
<?php else: ?>
<strong><?php echo $this->__('<span class=search-number>%s</span> items found.', $this->getTotalNum()) ?></strong>
<?php endif; ?>
</p>
您可以使用:
<p class="amount">
<?php if($this->getTotalNum() == 1): ?>
<?php echo $this->__('<span class=search-number>1</span> item found.') ?>
<?php else if($this->getLastPageNum()>1): ?>
<?php echo $this->__('<span class=search-number>%s</span> items found. Showing %s to %s.', $this->getTotalNum(), $this->getFirstNum(), $this->getLastNum()) ?>
<?php else: ?>
<strong><?php echo $this->__('<span class=search-number>%s</span> items found.', $this->getTotalNum()) ?></strong>
<?php endif; ?>
</p>