我在Magento网站的标题部分创建了一个CMS静态块。在主页上,它显示我想要的方式,但是在我访问我网站的每个其他页面上,它都会向左移动。任何帮助深表感谢。我的网站是http://diycomp.com
这是我的Header.phtml代码,CMS块标题为“FreeShip”:
<div class="header-container">
<div class="header">
<?php if ($this->getIsHomePage()):?>
<h1 class="logo"><strong><?php echo $this->getLogoAlt() ?></strong><a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" class="logo"><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" /></a></h1>
<?php else:?>
<a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" class="logo"><strong><?php echo $this->getLogoAlt() ?></strong><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" <?php endif?><?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('FreeShip')->toHtml() ?> </a>
</div>
<div class="quick-access">
<?php echo $this->getChildHtml('store_language') ?>
<p class="welcome-msg"><?php echo $this->getChildHtml('welcome') ?></p>
<?php echo $this->getChildHtml('topLinks') ?>
</div>
<?php echo $this->getChildHtml('topBar') ?>
<?php echo $this->getChildHtml('topContainer'); ?>
答案 0 :(得分:0)
您忘记关闭<img>
分支上的else
标记了。
这个
<?php else:?>
<a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" class="logo"><strong><?php echo $this->getLogoAlt() ?></strong><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" <?php endif?>
应该是
<?php else:?>
<a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" class="logo"><strong><?php echo $this->getLogoAlt() ?></strong><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" /> <?php endif?>