1

i just installed magento 2.1 on localhost, in \app\design\frontend there is only a Magento folder. The logo is using luma.

i've read this post How to load a phtml file only for homepage? (Magento 2)

But my problems is if i create this

/app/design/frontend/name/themename/Magento_Cms/layout/cms_index_index.xml

What is the name and themename (exact path) should be, anyone know? And if i use this code in above xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
   <referenceContainer name="page.top">
     <block class="Magento\Framework\View\Element\Template" name="startphoto" template="Magento_Theme::html/startphotos.phtml">
        <arguments>
            <argument name="section" xsi:type="string">homepage</argument>
            <argument name="position" xsi:type="number">0</argument>
        </arguments>
     </block>
  </referenceContainer>         
</page>

What is the exact path of startphotos.phtml should be?

"UPDATE 1"

i have placed the cms_index_index.xml at

C:\xampp\htdocs\m2\app\design\frontend\randomname\theme-frontend-luma\Magento_Theme\layout

and startphotos.phtml at

C:\xampp\htdocs\m2\app\design\frontend\randomname\theme-frontend-luma\Magento_Theme\template\html

But nothing appear in homepage, any ideas? Should i need to use any command make it appear?

"UPDATE 2"

i have created a theme copy from vendor\magento\theme-frontend-luma to C:\xampp\htdocs\m2\app\design\frontend\randomname\luma_clone

layout location: app\design\frontend\randomname\luma_clone\Magento_Theme\layout
phtml location: app\design\frontend\randomname\luma_clone\Magento_Theme\template\html

nothing appear.

"UPDATE 3" The problem was solved because of template**(s)**

1

The path you have given looks for the template in

/app/design/frontend/name/themename/Magento_Theme/template/html/startphotos.phtml

edit: Oh, I see it is a multi-part question.

The name and themename should be your company and you childthemes name. Please see the official documentation on how to create a theme:

http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/themes/theme-create.html

To create a child-theme, please see this: How to create a Child Theme in Magento 2

  • what is the default theme/theme name of fresh installation? Does it include in fresh install? – hkguile Aug 3 '16 at 1:37
  • i found the theme is using vendor\magento\theme-frontend-luma which parent theme is blank, so who to load a phtml under this theme? – hkguile Aug 3 '16 at 2:21
  • Using vendor means you have installed magento2 using composer. You should not edit anything in the vendor folder. Create a luma childtheme in app/design and only place those files in there you wish to override. See the link in my answer. Please mark the answer if it helped you. – tecjam Aug 3 '16 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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