>我需要下面的php语法帮助。因为我有几个带有洋红色的商店视图,所以粗体字Warenkorb应该替换为以下内容:
<?php echo $this->__('My Cart') ?>
这样,在其他商店视图中,Warenkorb一词将被翻译。
有人知道如何做到这一点吗?
<?php
//get total items in cart
$count = $this->helper('checkout/cart')->getSummaryCount();
//get total price
$total = $this->helper('checkout/cart')->getQuote()->getGrandTotal();
if( $count == 0 ) {
echo $this->__(' <a href="http://www.cococana.de/index.php/checkout/cart/"> Warenkorb: <br />   %s',$count);
}
if( $count == 1 ) {
echo $this->__(' <a href="http://www.cococana.de/index.php/checkout/cart/"> Warenkorb <br />  ',$count);
}
if( $count > 1 ) {
echo $this->__(' <a href="http://www.cococana.de/index.php/checkout/cart/"> Warenkorb: <br />   %s',$count);
}
echo $this->__(' Artikel: %s', $this->helper('core')->formatPrice($total, false));
?>
magento 中的翻译是通过您已经在使用的块和辅助方法完成的__()
。
他们接受任意数量的论点。第一个参数是带有可选占位符 (%s) 的字符串,以下参数充当占位符的替换符。
你也已经在使用它了。
字符串将根据您必须提供的相关翻译文件进行翻译。阅读此内容以获取更多信息。
是的..使用css进行间距。不仅因为您还必须在翻译文件中使用该字符串(这将是一个巨大的PITA,其中包含所有这些
),而且布局和内容的分离被认为是几十年来的最佳实践。