새 페이지 레이아웃 옵션 Magento 추가


11

CMS 페이지에서 선택할 수있는 옵션 인 Magento에 새 페이지 레이아웃을 추가하고 싶습니다. 1-column.phtml코드를 복사하여 약간 수정하여로 변경했습니다.1-column-version2.phtml.

CMS 파일 레이아웃 옵션에 표시되도록 새 파일을 참조하는 방법에 대해 알고 싶습니다 .

.

답변:


18

요구 사항을 충족 시키려면 확장 기능을 만들어야합니다. 그렇지 않으면 확장 기능을 사용할 수 없습니다.

모듈 설정 파일 :

에 모듈 파일 구성 파일을 만듭니다. app/etc/modules/Amit_NewLayout.xml

암호:

<?xml version="1.0"?>
<config>
    <modules>
        <Amit_NewLayout>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Page />
            </depends>
        </Amit_NewLayout>
    </modules>
</config>

config.xml 정의

이제 1-column-version2.phtml새 레이아웃의 템플릿으로 정의 하십시오. app/code/local/Amit/NewLayout/etc/config.xml

암호:

<?xml version="1.0"?> 
<config>
    <modules>
        <Amit_NewLayout>
            <version>0.0.1</version>
        </Amit_NewLayout>
    </modules>
    <global>
        <page>
            <layouts> 
                <new_cms_layout module="page" translate="label">
                    <label>New Cms Layout</label>
                    <template>page/1-column-version2.phtml</template>
                    <layout_handle>lookbook</layout_handle>
                </new_cms_layout> 
            </layouts>
        </page>
    </global>
</config>

이제 CMS 페이지 레이아웃 옵션에서이 레이아웃을 볼 수 있습니다.


이 게시물이 없으면 불가능합니다.
— jmargolisvt

1

하나의 모듈을 작성하고 config.xml 파일에서 xml 아래에 추가하십시오.

app/code/local/Namespace/CustomLayouts/etc/config.xml

<?xml version="1.0"?>
<config>
 <global>
  <page>
   <layouts>
    <custom_static_page_one>
     <label>Custom static page</label>
     <template>page/1-column-version2.phtml</template>
    </custom_static_page_one>
   </layouts>
  </page>
 </global>
</config>

모듈 등록

app/etc/modules/Namespace_CustomLayouts.xml

<?xml version="1.0"?>
<config>
 <modules>
  <Namespace_CustomLayouts>
   <codePool>local</codePool>
   <active>true</active>
  </Namespace_CustomLayouts>
 </modules>
</config>

나만의 템플릿 파일 만들기 page/1-column-version2.phtml


-3

코드를 추가하십시오

app\code\core\Mage\Page\etc

config.xml:

와

 <My_one_column_cms module="page" translate="label">
        <label>My One Column</label>
        <template>page/home.phtml</template>
        <layout_handle>My_one_column_cms</layout_handle>
        </My_one_column_cms>

U에서 원하는대로 이름을 바꿀 수 있습니다.

그런 다음 newtheme / newpack / page / 또는 ur 기본 테마에서 템플리트로 home.phtml을 작성하십시오.


코어 파일을 수정하는 것은 현명하지 않습니다.
— KiwisTasteGood

코어 파일을 직접 변경해서는 안됩니다. 자세히 설명하면 Magento 인스턴스를 업그레이드하면 변경 사항이 손실됩니다. 그렇기 때문에 Amit Bera의 답변
— JoshCarter
당사 사이트를 사용함과 동시에 당사의 쿠키 정책과 개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.