5

Im going crazy here. Can't get this to work. I'd like to make a custom page layout like the 1column, 2columns-left etc. I've searched and read multiple tutorials all doing the same. Nothing works though. I've got the below code. Am I overlooking something maybe?

Many thanks if you guys could help me with this.


Vendor: Experius

Theme: aras


* Step 1: Define custom page layout:*

app/design/frontend/Experius/aras/Magento_Theme/layouts.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page_layouts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/PageLayout/etc/layouts.xsd">
    <layout id="splash-page">
        <label translate="true">Splash page</label>
    </layout>
</page_layouts>

Step 2: Define page layout of custom page layout

app/design/frontend/Experius/aras/Magento_Theme/page_layout/splash-page.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
    <update handle="empty"/>
</layout>

Step 3: Add new block to custom page layout page wrapper container

app/design/frontend/Experius/aras/Magento_Theme/layout/default.xml

<?xml version="1.0"?>
<page layout="splash-page" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <referenceContainer name="page.wrapper">
        <block class="Magento\Framework\View\Element\Template" before="-" name="splash.backgroundimage.container" template="Experius_ContentPage::html/backgroundimage-container.phtml" />
    </referenceContainer>
</page>
2
  • I think you should create a custom module with page layout. it working with me.
    – LinoPham
    Oct 26, 2016 at 17:50
  • Have you tried changing a specific page, for example change the product page to use your splash-page layout? It could be that your code works but is being overwritten by another file. Also, a daft question but it needs to be asked. Have you cleared your caches after making the change?
    – Ben Crook
    Oct 31, 2016 at 12:39

2 Answers 2

0

You probably have to add your code in the splash-page.xml file

app/design/frontend/Experius/aras/Magento_Theme/page_layout/splash-page.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
    <update handle="empty"/>

    <referenceContainer name="page.wrapper">
        <block class="Magento\Framework\View\Element\Template" before="-" name="splash.backgroundimage.container" template="Experius_ContentPage::html/backgroundimage-container.phtml" />
    </referenceContainer>
</layout>
-1

I was having the same issue as you exactly. I'd spent several hours searching for the answer then found this page. I followed your steps above had the same blank page result unless I relocated splash-page.xml.

I went back to basics and realised I could fix it by installing Magento a different way. Although therer probably is a better fix while keeping the same installation, the best fix for me was to change how Magento was installed.

Re this guide:http://inchoo.net/magento-2/how-to-install-magento-2/.

There are 3 ways to install: 1. Download zip, 2. Composer, 3. GitHub.

I had used the GitHub method, but i hadn't realised at the time this means you'll be running a Beta version of Magento and it holds the core Magento theme files in a different location.

So if you have this problem, I would recommend going back to basics and installing by composer. I checked again using your files exactly as detailed above and it works perfectly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.