Magento 디자인을 편집하는 대신 (예 : page.xml을 편집하는 대신 local.xml을 사용하여) Magento 디자인을 편집하는 것이 최선이지만 시스템이 너무 끔찍하고 뒤죽박죽이어서, 그렇게하는 것이 심각하게 까다로울 수 있습니다.Magento의 top.links (topLinks) 블록을 이동할 수 없습니다.
내가 지금 가지고있는 문제는 "top.links"블록을 헤더의 다른 블록으로 옮길 수 없다는 것입니다. 현재 page.xml의이 블록은 헤더 블록 안에 있습니다. 이 기능을 사용하려면 local.xml에서 모든 것을 시도했지만 다음 편집을 시도했습니다.
헤더에서 top.links를 제거하고 "Hud"블록을 추가하십시오. 링크 (이는 HUD 블록이다) 갈색 상자 안에해야한다는
<layout version="0.1.0">
<default>
<!-- Here is where we edit the header block -->
<reference name="header">
<remove name="top.links" />
<remove name="top.search" />
<!-- This is the block that holds the HUD -->
<block type="page/html" name="hud" as="hud" template="page/html/hud.phtml">
<block type="page/template_links" name="top.links" as="topLinks" />
</block>
</reference>
</default>
</layout>
는
참고.
헤더에서 top.links 블록을 제거하지만 허드 블록
<layout version="0.1.0">
<default>
<!-- Here is where we edit the header block -->
<reference name="header">
<remove name="top.search" />
<!-- This is the block that holds the HUD -->
<block type="page/html" name="hud" as="hud" template="page/html/hud.phtml">
<block type="page/template_links" name="top.links" as="topLinks" />
</block>
</reference>
</default>
</layout>
만든 새 링크 템플릿 top.links의 코드를 기반으로 추가하고이 언급하지 HUD의 블록은 다음과 같습니다.
<layout version="0.1.0">
<default>
<!-- Here is where we edit the header block -->
<reference name="header">
<remove name="top.links" />
<remove name="top.search" />
<!-- This is the block that holds the HUD -->
<block type="page/html" name="hud" as="hud" template="page/html/hud.phtml">
<block type="page/template_links" name="hud.links" as="hudLinks" template="page/template/hudLinks.phtml"/>
</block>
</reference>
</default>
</layout>
다음은이 가장 흥미있는 결과를 제공
<!-- hud.phtml -->
<div id="hud">
<h3>Welcome</h3>
<?php echo $this->getChildHtml('hudLinks') ?>
<?php echo $this->getChildHtml('top.search') ?>
</div>
hud.phtml입니다. 템플릿을 찾았지만 아무 것도 나타나지 않습니다.
나는 정말이와 단서입니다. 나는 여기서 완전히 잘못된 것을하고 있는가? 가치가있는 것을 위해, 여기 hudLinks.phtml과 top.links 템플릿에 사용하고있는 코드가 있습니다.
<?php $_links = $this->getLinks(); ?>
<?php if(count($_links)>0): ?>
<ul class="links"<?php if($this->getName()): ?> id="<?php echo $this->getName() ?>"<?php endif;?>>
<?php foreach($_links as $_link): ?>
<li<?php if($_link->getIsFirst()||$_link->getIsLast()): ?> class="<?php if($_link->getIsFirst()): ?>first<?php endif; ?><?php if($_link->getIsLast()): ?> last<?php endif; ?>"<?php endif; ?> <?php echo $_link->getLiParams() ?>><?php echo $_link->getBeforeText() ?><a href="<?php echo $_link->getUrl() ?>" title="<?php echo $_link->getTitle() ?>" <?php echo $_link->getAParams() ?>><?php echo $_link->getLabel() ?></a><?php echo $_link->getAfterText() ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
자신의 테마 인 경우'page.xml'을 편집 할 때 문제가 발생하지 않습니다. – clockworkgeek
기본적으로 시작한 테마는 Magento의 기반 인 page.xml 파일을 사용합니다. 내 자신의 테마의 레이아웃 폴더 내에서 page.xml 파일을 사용하여이 작업을 재정의하려했지만 작동하지 않는 것 같습니다. 귀하의 회신에 감사드립니다. –