문제

I have a CMS 페이지 1 열 레이아웃이 있습니다.고 싶은 페이지를 이동 제목인 컨테이너의 페이지입니다.현재 설정을 다음과 같습니다:

<div class="main-container col1-layout">
       <div class="main">
         <div class="page-title">
           <h1>Page Title</h1>
         </div>
           <p>Some content here..</p>               
        </div>
       </div>
 </div>

고 싶은 페이지 제목 요소에 앉아서 외부의 주요 용기입니다.이 될 수 있습니다 수행을 통해 XML 업데이트?

도움이 되었습니까?

해결책

당신은 할 수 없이 간단한 레이아웃 업데이트 xml.가장 쉬운 방법으로 이를 달성하기 위해 만들은 새로운 루트 템플릿을 특정 cms 페이지입니다.단계에 대해 이것은 아래와 같습니다.

1.레이아웃 업데이트 XML 파일

CMS > Pages > [Select your CMS Page] > Design > Layout Update XML 섹션입니다.이 레이아웃 업데이트 코드가 있다.

<!-- removing default page heading block -->
<reference name="content">
    <remove name="page_content_heading" />
</reference>

<!-- defines new root template;add new page head block -->
<reference name="root">
    <action method="setTemplate">
        <template>custom/page/cms_1column.phtml</template>
    </action>
     <block type="core/template" name="cms_page_heading" as="cms_page_heading" template="cms/content_heading.phtml"/>
</reference>

이 코드는 기본적으로 수행하는 3 작업입니다.

  1. 그것을 제거하는 기본 CMS 페이지 제목에서 레이아웃그래서 그것은 결국 제거하는 기본 제목의 섹션에서 보고 있는 당신의 cms 페이지입니다.

  2. 그것이 정의하는 새로운 루트 템플릿 custom/page/cms_1column.phtml 를 위한 CMS 페이지설명할 것입니다 왜 우리가 이것을 해야 합니다.

  3. 우리는 다시 재정 CMS 페이지 제목 블럭이지만,이 시간은 내부 오 root 블록고지 내 content 니다.

2.사용자 정의 루트 템플릿

지금은 새로운 파일을 생성 app\design\frontend\[package]\[theme]\template\custom/page/cms_1column.phtml 고 복사하여 붙여 넣기를 모든 콘텐츠의 app\design\frontend\[package]\[theme]\template\page/1column.phtml 하는 파일입니다.그런 다음 우리의 제목 블록 안에 있는 파일로 다음과 같다.

<div class="wrapper">
    <?php echo $this->getChildHtml('global_notices') ?>
    <div class="page">
        <?php echo $this->getChildHtml('header') ?>
        <?php echo $this->getChildHtml('cms_page_heading') ?>
        <div class="main-container col1-layout">
            <div class="main">
                ...

당신이 볼 수 있습니다 <?php echo $this->getChildHtml('cms_page_heading') ?> 이 부분에 렌더링 CMS 페이지 제목 블록고의 위 올 레이아웃-div 니다.당신의 위치를 조정할 수 있습 CMS 페이지 제목 블럭에 따라 귀하의 필요에 따라 필요합니다.

우리가 사용하는 새로운 루트 템플릿을 만에 추가하기 위해 사용자 지정 CMS 페이지 제목 블록입니다.이를 만지지 않도록의 코어 파일이고,따라서 최상의 솔루션이 될 것이 이 경우에.

다른 팁

이 XML을 수행 할 수 없습니다.XML

에 따라
<cms_page translate="label">
        <label>CMS Pages (All)</label>
        <reference name="content">
            <block type="core/template" name="page_content_heading" template="cms/content_heading.phtml"/>
            <block type="page/html_wrapper" name="cms.wrapper" translate="label">
                <label>CMS Content Wrapper</label>
                <action method="setElementClass"><value>std</value></action>
                <block type="cms/page" name="cms_page"/>
            </block>
        </reference>
    </cms_page>
.

페이지 제목은 CMS 페이지가 내부 콘텐츠 영역 호출되는 content_heading.phtml에서 오는 페이지입니다.

와 같은 1column.phtml에서 조건을 넣을 수있는 주요 컨테이너를 꺼낼 수 있습니다.
<?php if(Mage::app()->getRequest()->getRouteName() === 'cms' && $this->getContentHeading()):?>
    <div class="page-title">
        <h1><?php echo $this->getContentHeading(); ?></h1>
    </div>
<?php endif; ?>
.

또는 좋은 방법은 CMS 페이지에 대한 자신의 루트 파일을 설정하고 해당 파일에서 요구 사항을 변경할 수 있습니다.

CMS 페이지의 새 레이아웃에 대한 단계를 수행 할 수 있습니다. 여기

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top