getskinurl()函数进入基本路径以获取图像
<?php if(count($this->getStores())>1): ?>
<div id="languages_box">
<ul id='languages'>
<?php foreach ($this->getStores() as $_lang): ?>
<?php $_selected = ($_lang->getId() == $this->getCurrentStoreId()) ? ' selected="selected"' : '' ?>
<li><a href="<?php echo $_lang->getCurrententer code hereUrl() ?>">
<img src="<?php echo $this->getSkinUrl('images/flags/'.$_lang->getCode().'.gif');?>" alt="<?php echo $_lang->getCode();?>">
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
答案 0 :(得分:2)
您好,您可以尝试使用此
<?php if(count($this->getStores())>1): ?>
<div class="language-switcher">
<!--<span>Your Language: </span>-->
<?php foreach ($this->getStores() as $_lang): ?>
<a href="<?php echo $_lang->getCurrentUrl() ?>" title="<?php echo $this->htmlEscape($_lang->getName()) ?>">
<?php //echo $this->htmlEscape($_lang->getCode()) ?>
<img src="<?php echo $this->getSkinUrl('images/flag/').$this->htmlEscape($_lang->getCode()).'.png' ?>" alt="<?php echo $this->htmlEscape($_lang->getName()) ?>" />
</a>
<?php endforeach; ?>
</div>
<?php endif; ?>
答案 1 :(得分:0)
当您不从Magento后端更改默认外观目录时,通常会发生这种情况。
系统&gt;配置&gt;一般&gt;设计。
这应该更改为主题的皮肤文件夹。同样,如果默认目录被更改,但如果magento没有找到它,它将采用基础皮肤文件夹。
答案 2 :(得分:0)
<?php if(count($this->getStores())>1): ?>
<div class="language-switcher">
<!--<span>Your Language: </span>-->
<?php foreach ($this->getStores() as $_lang): ?>
<a href="<?php echo $_lang->getCurrentUrl() ?>" title="<?php echo $this->htmlEscape($_lang->getName()) ?>">
<?php //echo $this->htmlEscape($_lang->getCode()) ?>
<img src="<?php echo $this->getSkinUrl('images/flag/').$this->htmlEscape($_lang->getCode()).'.png' ?>" alt="<?php echo $this->htmlEscape($_lang->getName()) ?>" />
</a>
<?php endforeach; ?>
</div>
<?php endif; ?>