Magento2 sample custom admin module showing blank page Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?How can i rewrite TierPrice Block in Magento2Magento2 - Custom Admin Module - UI Form Component showing blank pagemagento 2 captcha not rendering if I override layout xmlI created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?main.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 Can't view module's front end page output?Deleted ShipperHQ module causing error in “All Customers” section of Magento 2
Would it be easier to apply for a UK visa if there is a host family to sponsor for you in going there?
How do living politicians protect their readily obtainable signatures from misuse?
How often does castling occur in grandmaster games?
Is there public access to the Meteor Crater in Arizona?
What do you call the main part of a joke?
Random body shuffle every night—can we still function?
What does it mean that physics no longer uses mechanical models to describe phenomena?
How did Fremen produce and carry enough thumpers to use Sandworms as de facto Ubers?
Is CEO the "profession" with the most psychopaths?
How many time has Arya actually used Needle?
Lagrange four-squares theorem --- deterministic complexity
How much damage would a cupful of neutron star matter do to the Earth?
What is the difference between a "ranged attack" and a "ranged weapon attack"?
Drawing spherical mirrors
How to identify unknown coordinate type and convert to lat/lon?
Tannaka duality for semisimple groups
What is the chair depicted in Cesare Maccari's 1889 painting "Cicerone denuncia Catilina"?
Why do early math courses focus on the cross sections of a cone and not on other 3D objects?
Antipodal Land Area Calculation
What makes a man succeed?
Intuitive explanation of the rank-nullity theorem
Dyck paths with extra diagonals from valleys (Laser construction)
Amount of permutations on an NxNxN Rubik's Cube
How would a mousetrap for use in space work?
Magento2 sample custom admin module showing blank page
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?How can i rewrite TierPrice Block in Magento2Magento2 - Custom Admin Module - UI Form Component showing blank pagemagento 2 captcha not rendering if I override layout xmlI created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?main.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 Can't view module's front end page output?Deleted ShipperHQ module causing error in “All Customers” section of Magento 2
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am trying to display something when click on a link from admin menu. So i created a simple module and when i click from the admin menu it redirect to mydomain/secure-manage/helloworld/index/index/key/... with status 200 but the page is blank.
In devtool i can see the css and js are loaded but nothing inside the body tag.
1.folder structure
Inchoo
Helloworld
-Block
-Adminhtml
Helloworld.php
-Controller
-Adminhtml
-Index
Index.php
-etc
-module.xml
-adminhtml
-menu.xml
-routes.xml
-view
adminhtml
layout
-helloworld_index_index.xml
templates
-helloworld.phtml
registration.php
2.Block/Adminhtml/Helloworld.php
<?php
namespace InchooHelloworldBlock;
class Helloworld extends MagentoFrameworkViewElementTemplate
public function getHelloWorldTxt()
return 'Hello world!';
3.Controller/Adminhtml/Index/Index.php
<?php
namespace InchooHelloworldControllerAdminhtmlIndex;
use MagentoFrameworkAppActionContext;
class Index extends MagentoFrameworkAppActionAction
protected $_resultPageFactory;
public function __construct(Context $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory)
$this->_resultPageFactory = $resultPageFactory;
parent::__construct($context);
public function execute()
$resultPage = $this->_resultPageFactory->create();
// print_r($resultPage);exit;
return $resultPage;
4.etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/
module.xsd">
<module name="Inchoo_Helloworld" setup_version="1.0.0">
</module>
</config>
5.etc/adminhtml/menu.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc
/menu.xsd">
<menu>
<add id="Inchoo_Helloworld::first_pincollect_pincheck"
title="Greetings"
module="Inchoo_Helloworld"
sortOrder="50"
dependsOnModule="Inchoo_Helloworld"
resource="Magento_Backend::content" />
<add id="Inchoo_Helloworld::second_pincollect_pincheck"
title="Manage Pincodes"
module="Inchoo_Helloworld"
sortOrder="0"
action="helloworld/index"
parent="Inchoo_Helloworld::first_pincollect_pincheck"
resource="Magento_Backend::content" />
</menu>
</config>
6.etc/adminhtml/routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc
/routes.xsd">
<router id="admin">
<route id="helloworld" frontName="helloworld">
<module name="Inchoo_Helloworld" />
</route>
</router>
</config>
7.view/adminhtml/layout/helloworld_index_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../lib/
internal/Magento/Framework/View/Layout/etc/page_configuration.xsd"
layout="1column">
<body>
<referenceContainer name="content">
<block class="InchooHelloworldBlockAdminhtmlHelloworld"
name="helloworld" template="helloworld.phtml" />
</referenceContainer>
</body>
</page>
8.view/adminhtml/templates/helloworld.phtml
<p>Hello World!</p>
how can i debug this, please help me guys.
Thanks in advance.
magento2
add a comment |
I am trying to display something when click on a link from admin menu. So i created a simple module and when i click from the admin menu it redirect to mydomain/secure-manage/helloworld/index/index/key/... with status 200 but the page is blank.
In devtool i can see the css and js are loaded but nothing inside the body tag.
1.folder structure
Inchoo
Helloworld
-Block
-Adminhtml
Helloworld.php
-Controller
-Adminhtml
-Index
Index.php
-etc
-module.xml
-adminhtml
-menu.xml
-routes.xml
-view
adminhtml
layout
-helloworld_index_index.xml
templates
-helloworld.phtml
registration.php
2.Block/Adminhtml/Helloworld.php
<?php
namespace InchooHelloworldBlock;
class Helloworld extends MagentoFrameworkViewElementTemplate
public function getHelloWorldTxt()
return 'Hello world!';
3.Controller/Adminhtml/Index/Index.php
<?php
namespace InchooHelloworldControllerAdminhtmlIndex;
use MagentoFrameworkAppActionContext;
class Index extends MagentoFrameworkAppActionAction
protected $_resultPageFactory;
public function __construct(Context $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory)
$this->_resultPageFactory = $resultPageFactory;
parent::__construct($context);
public function execute()
$resultPage = $this->_resultPageFactory->create();
// print_r($resultPage);exit;
return $resultPage;
4.etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/
module.xsd">
<module name="Inchoo_Helloworld" setup_version="1.0.0">
</module>
</config>
5.etc/adminhtml/menu.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc
/menu.xsd">
<menu>
<add id="Inchoo_Helloworld::first_pincollect_pincheck"
title="Greetings"
module="Inchoo_Helloworld"
sortOrder="50"
dependsOnModule="Inchoo_Helloworld"
resource="Magento_Backend::content" />
<add id="Inchoo_Helloworld::second_pincollect_pincheck"
title="Manage Pincodes"
module="Inchoo_Helloworld"
sortOrder="0"
action="helloworld/index"
parent="Inchoo_Helloworld::first_pincollect_pincheck"
resource="Magento_Backend::content" />
</menu>
</config>
6.etc/adminhtml/routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc
/routes.xsd">
<router id="admin">
<route id="helloworld" frontName="helloworld">
<module name="Inchoo_Helloworld" />
</route>
</router>
</config>
7.view/adminhtml/layout/helloworld_index_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../lib/
internal/Magento/Framework/View/Layout/etc/page_configuration.xsd"
layout="1column">
<body>
<referenceContainer name="content">
<block class="InchooHelloworldBlockAdminhtmlHelloworld"
name="helloworld" template="helloworld.phtml" />
</referenceContainer>
</body>
</page>
8.view/adminhtml/templates/helloworld.phtml
<p>Hello World!</p>
how can i debug this, please help me guys.
Thanks in advance.
magento2
have you run deploy and cache flush command from cli
– Bachcha Singh
Jan 17 '18 at 8:43
Hi Bachcha Singh, tried but no luck.
– Vivek Xavier
Jan 17 '18 at 9:27
add a comment |
I am trying to display something when click on a link from admin menu. So i created a simple module and when i click from the admin menu it redirect to mydomain/secure-manage/helloworld/index/index/key/... with status 200 but the page is blank.
In devtool i can see the css and js are loaded but nothing inside the body tag.
1.folder structure
Inchoo
Helloworld
-Block
-Adminhtml
Helloworld.php
-Controller
-Adminhtml
-Index
Index.php
-etc
-module.xml
-adminhtml
-menu.xml
-routes.xml
-view
adminhtml
layout
-helloworld_index_index.xml
templates
-helloworld.phtml
registration.php
2.Block/Adminhtml/Helloworld.php
<?php
namespace InchooHelloworldBlock;
class Helloworld extends MagentoFrameworkViewElementTemplate
public function getHelloWorldTxt()
return 'Hello world!';
3.Controller/Adminhtml/Index/Index.php
<?php
namespace InchooHelloworldControllerAdminhtmlIndex;
use MagentoFrameworkAppActionContext;
class Index extends MagentoFrameworkAppActionAction
protected $_resultPageFactory;
public function __construct(Context $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory)
$this->_resultPageFactory = $resultPageFactory;
parent::__construct($context);
public function execute()
$resultPage = $this->_resultPageFactory->create();
// print_r($resultPage);exit;
return $resultPage;
4.etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/
module.xsd">
<module name="Inchoo_Helloworld" setup_version="1.0.0">
</module>
</config>
5.etc/adminhtml/menu.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc
/menu.xsd">
<menu>
<add id="Inchoo_Helloworld::first_pincollect_pincheck"
title="Greetings"
module="Inchoo_Helloworld"
sortOrder="50"
dependsOnModule="Inchoo_Helloworld"
resource="Magento_Backend::content" />
<add id="Inchoo_Helloworld::second_pincollect_pincheck"
title="Manage Pincodes"
module="Inchoo_Helloworld"
sortOrder="0"
action="helloworld/index"
parent="Inchoo_Helloworld::first_pincollect_pincheck"
resource="Magento_Backend::content" />
</menu>
</config>
6.etc/adminhtml/routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc
/routes.xsd">
<router id="admin">
<route id="helloworld" frontName="helloworld">
<module name="Inchoo_Helloworld" />
</route>
</router>
</config>
7.view/adminhtml/layout/helloworld_index_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../lib/
internal/Magento/Framework/View/Layout/etc/page_configuration.xsd"
layout="1column">
<body>
<referenceContainer name="content">
<block class="InchooHelloworldBlockAdminhtmlHelloworld"
name="helloworld" template="helloworld.phtml" />
</referenceContainer>
</body>
</page>
8.view/adminhtml/templates/helloworld.phtml
<p>Hello World!</p>
how can i debug this, please help me guys.
Thanks in advance.
magento2
I am trying to display something when click on a link from admin menu. So i created a simple module and when i click from the admin menu it redirect to mydomain/secure-manage/helloworld/index/index/key/... with status 200 but the page is blank.
In devtool i can see the css and js are loaded but nothing inside the body tag.
1.folder structure
Inchoo
Helloworld
-Block
-Adminhtml
Helloworld.php
-Controller
-Adminhtml
-Index
Index.php
-etc
-module.xml
-adminhtml
-menu.xml
-routes.xml
-view
adminhtml
layout
-helloworld_index_index.xml
templates
-helloworld.phtml
registration.php
2.Block/Adminhtml/Helloworld.php
<?php
namespace InchooHelloworldBlock;
class Helloworld extends MagentoFrameworkViewElementTemplate
public function getHelloWorldTxt()
return 'Hello world!';
3.Controller/Adminhtml/Index/Index.php
<?php
namespace InchooHelloworldControllerAdminhtmlIndex;
use MagentoFrameworkAppActionContext;
class Index extends MagentoFrameworkAppActionAction
protected $_resultPageFactory;
public function __construct(Context $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory)
$this->_resultPageFactory = $resultPageFactory;
parent::__construct($context);
public function execute()
$resultPage = $this->_resultPageFactory->create();
// print_r($resultPage);exit;
return $resultPage;
4.etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/
module.xsd">
<module name="Inchoo_Helloworld" setup_version="1.0.0">
</module>
</config>
5.etc/adminhtml/menu.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc
/menu.xsd">
<menu>
<add id="Inchoo_Helloworld::first_pincollect_pincheck"
title="Greetings"
module="Inchoo_Helloworld"
sortOrder="50"
dependsOnModule="Inchoo_Helloworld"
resource="Magento_Backend::content" />
<add id="Inchoo_Helloworld::second_pincollect_pincheck"
title="Manage Pincodes"
module="Inchoo_Helloworld"
sortOrder="0"
action="helloworld/index"
parent="Inchoo_Helloworld::first_pincollect_pincheck"
resource="Magento_Backend::content" />
</menu>
</config>
6.etc/adminhtml/routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc
/routes.xsd">
<router id="admin">
<route id="helloworld" frontName="helloworld">
<module name="Inchoo_Helloworld" />
</route>
</router>
</config>
7.view/adminhtml/layout/helloworld_index_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../lib/
internal/Magento/Framework/View/Layout/etc/page_configuration.xsd"
layout="1column">
<body>
<referenceContainer name="content">
<block class="InchooHelloworldBlockAdminhtmlHelloworld"
name="helloworld" template="helloworld.phtml" />
</referenceContainer>
</body>
</page>
8.view/adminhtml/templates/helloworld.phtml
<p>Hello World!</p>
how can i debug this, please help me guys.
Thanks in advance.
magento2
magento2
edited Jan 17 '18 at 8:16
Vivek Xavier
asked Jan 17 '18 at 6:51
Vivek XavierVivek Xavier
83
83
have you run deploy and cache flush command from cli
– Bachcha Singh
Jan 17 '18 at 8:43
Hi Bachcha Singh, tried but no luck.
– Vivek Xavier
Jan 17 '18 at 9:27
add a comment |
have you run deploy and cache flush command from cli
– Bachcha Singh
Jan 17 '18 at 8:43
Hi Bachcha Singh, tried but no luck.
– Vivek Xavier
Jan 17 '18 at 9:27
have you run deploy and cache flush command from cli
– Bachcha Singh
Jan 17 '18 at 8:43
have you run deploy and cache flush command from cli
– Bachcha Singh
Jan 17 '18 at 8:43
Hi Bachcha Singh, tried but no luck.
– Vivek Xavier
Jan 17 '18 at 9:27
Hi Bachcha Singh, tried but no luck.
– Vivek Xavier
Jan 17 '18 at 9:27
add a comment |
3 Answers
3
active
oldest
votes
I am giving you the exact code and path please copy and paste the below file.
app/code/Inchoo/Helloworld/registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Inchoo_Helloworld',
__DIR__
);
app/code/Inchoo/Helloworld/Block/Adminhtml/Index/Index.php
<?php
namespace InchooHelloworldBlockAdminhtmlIndex;
class Index extends MagentoBackendBlockWidgetContainer
public function __construct(MagentoBackendBlockWidgetContext $context,array $data = [])
parent::__construct($context, $data);
app/code/Inchoo/Helloworld/Controller/Adminhtml/Index/Index.php
<?php
namespace InchooHelloworldControllerAdminhtmlIndex;
class Index extends MagentoBackendAppAction
public function execute()
$this->_view->loadLayout();
$this->_view->getLayout()->initMessages();
$this->_view->renderLayout();
?>
app/code/Inchoo/Helloworld/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Inchoo_Helloworld" setup_version="1.0.0"></module>
<sequence>
<module name="Magento_Backend"/>
<module name="Magento_Sales"/>
<module name="Magento_Quote"/>
<module name="Magento_Checkout"/>
</sequence>
</config>
app/code/Inchoo/Helloworld/etc/adminhtml/routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd">
<router id="admin">
<route id="helloworld" frontName="helloworld">
<module name="Inchoo_Helloworld" before="Magento_Adminhtml" />
</route>
</router>
</config>
app/code/Inchoo/Helloworld/etc/adminhtml/menu.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Magento/Backend/etc/menu.xsd">
<menu>
<add id="Inchoo_Helloworld::parent" title="Helloworld" module="Inchoo_Helloworld" sortOrder="100" resource="Inchoo_Helloworld::parent"/>
<add id="Inchoo_Helloworld::index" title="Helloworld Index" module="Inchoo_Helloworld" sortOrder="10" action="helloworld/index" resource="Inchoo_Helloworld::index" parent="Inchoo_Helloworld::parent"/>
</menu>
</config>
app/code/Inchoo/Helloworld/view/adminhtml/layout/helloworld_index_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<head>
<title>Hello World</title>
</head>
<body>
<referenceContainer name="content">
<block class="InchooHelloworldBlockAdminhtmlIndexIndex" name="helloworld_block_adminhtml_index_index" template="Inchoo_Helloworld::helloworld_index_index.phtml" />
</referenceContainer>
</body>
</page>
app/code/Inchoo/Helloworld/view/adminhtml/templates/helloworld_index_index.phtml
<?php echo "Hello World template"; ?>
N:B After put all the files to the specific path don't forget to run this command from CLI -
php bin/magento setup:upgrade
php bin/magento cache:flush
My Pleasure..... @ Vivek. Feel free to like this answer.
– Soumik Rana
Jan 17 '18 at 10:48
add a comment |
First correct your folder structure name, Like
Inchoo
Helloworld
-Block
-Adminhtml
Helloworld.php
-Controller
-Adminhtml
-Index
-Index.php
-etc
-module.xml
-adminhtml
-menu.xml
-routes.xml
-view
-adminhtml
-layout
-helloworld_index_index.xml
-templates
-helloworld.phtml
-registration.php
hi rishabh, i corrected the structure like updated in the question but still not working.
– Vivek Xavier
Jan 17 '18 at 8:11
add a comment |
i was also facing the same issue Magento 2.3 CE. I gave the proper permissions for var and pub directories and ran the following commands-
- provided file permission for var/ and pub/
- setup:upgrade
- setup:static-content:deploy -f
- cache:flush
and it started to work.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f209739%2fmagento2-sample-custom-admin-module-showing-blank-page%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
I am giving you the exact code and path please copy and paste the below file.
app/code/Inchoo/Helloworld/registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Inchoo_Helloworld',
__DIR__
);
app/code/Inchoo/Helloworld/Block/Adminhtml/Index/Index.php
<?php
namespace InchooHelloworldBlockAdminhtmlIndex;
class Index extends MagentoBackendBlockWidgetContainer
public function __construct(MagentoBackendBlockWidgetContext $context,array $data = [])
parent::__construct($context, $data);
app/code/Inchoo/Helloworld/Controller/Adminhtml/Index/Index.php
<?php
namespace InchooHelloworldControllerAdminhtmlIndex;
class Index extends MagentoBackendAppAction
public function execute()
$this->_view->loadLayout();
$this->_view->getLayout()->initMessages();
$this->_view->renderLayout();
?>
app/code/Inchoo/Helloworld/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Inchoo_Helloworld" setup_version="1.0.0"></module>
<sequence>
<module name="Magento_Backend"/>
<module name="Magento_Sales"/>
<module name="Magento_Quote"/>
<module name="Magento_Checkout"/>
</sequence>
</config>
app/code/Inchoo/Helloworld/etc/adminhtml/routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd">
<router id="admin">
<route id="helloworld" frontName="helloworld">
<module name="Inchoo_Helloworld" before="Magento_Adminhtml" />
</route>
</router>
</config>
app/code/Inchoo/Helloworld/etc/adminhtml/menu.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Magento/Backend/etc/menu.xsd">
<menu>
<add id="Inchoo_Helloworld::parent" title="Helloworld" module="Inchoo_Helloworld" sortOrder="100" resource="Inchoo_Helloworld::parent"/>
<add id="Inchoo_Helloworld::index" title="Helloworld Index" module="Inchoo_Helloworld" sortOrder="10" action="helloworld/index" resource="Inchoo_Helloworld::index" parent="Inchoo_Helloworld::parent"/>
</menu>
</config>
app/code/Inchoo/Helloworld/view/adminhtml/layout/helloworld_index_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<head>
<title>Hello World</title>
</head>
<body>
<referenceContainer name="content">
<block class="InchooHelloworldBlockAdminhtmlIndexIndex" name="helloworld_block_adminhtml_index_index" template="Inchoo_Helloworld::helloworld_index_index.phtml" />
</referenceContainer>
</body>
</page>
app/code/Inchoo/Helloworld/view/adminhtml/templates/helloworld_index_index.phtml
<?php echo "Hello World template"; ?>
N:B After put all the files to the specific path don't forget to run this command from CLI -
php bin/magento setup:upgrade
php bin/magento cache:flush
My Pleasure..... @ Vivek. Feel free to like this answer.
– Soumik Rana
Jan 17 '18 at 10:48
add a comment |
I am giving you the exact code and path please copy and paste the below file.
app/code/Inchoo/Helloworld/registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Inchoo_Helloworld',
__DIR__
);
app/code/Inchoo/Helloworld/Block/Adminhtml/Index/Index.php
<?php
namespace InchooHelloworldBlockAdminhtmlIndex;
class Index extends MagentoBackendBlockWidgetContainer
public function __construct(MagentoBackendBlockWidgetContext $context,array $data = [])
parent::__construct($context, $data);
app/code/Inchoo/Helloworld/Controller/Adminhtml/Index/Index.php
<?php
namespace InchooHelloworldControllerAdminhtmlIndex;
class Index extends MagentoBackendAppAction
public function execute()
$this->_view->loadLayout();
$this->_view->getLayout()->initMessages();
$this->_view->renderLayout();
?>
app/code/Inchoo/Helloworld/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Inchoo_Helloworld" setup_version="1.0.0"></module>
<sequence>
<module name="Magento_Backend"/>
<module name="Magento_Sales"/>
<module name="Magento_Quote"/>
<module name="Magento_Checkout"/>
</sequence>
</config>
app/code/Inchoo/Helloworld/etc/adminhtml/routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd">
<router id="admin">
<route id="helloworld" frontName="helloworld">
<module name="Inchoo_Helloworld" before="Magento_Adminhtml" />
</route>
</router>
</config>
app/code/Inchoo/Helloworld/etc/adminhtml/menu.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Magento/Backend/etc/menu.xsd">
<menu>
<add id="Inchoo_Helloworld::parent" title="Helloworld" module="Inchoo_Helloworld" sortOrder="100" resource="Inchoo_Helloworld::parent"/>
<add id="Inchoo_Helloworld::index" title="Helloworld Index" module="Inchoo_Helloworld" sortOrder="10" action="helloworld/index" resource="Inchoo_Helloworld::index" parent="Inchoo_Helloworld::parent"/>
</menu>
</config>
app/code/Inchoo/Helloworld/view/adminhtml/layout/helloworld_index_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<head>
<title>Hello World</title>
</head>
<body>
<referenceContainer name="content">
<block class="InchooHelloworldBlockAdminhtmlIndexIndex" name="helloworld_block_adminhtml_index_index" template="Inchoo_Helloworld::helloworld_index_index.phtml" />
</referenceContainer>
</body>
</page>
app/code/Inchoo/Helloworld/view/adminhtml/templates/helloworld_index_index.phtml
<?php echo "Hello World template"; ?>
N:B After put all the files to the specific path don't forget to run this command from CLI -
php bin/magento setup:upgrade
php bin/magento cache:flush
My Pleasure..... @ Vivek. Feel free to like this answer.
– Soumik Rana
Jan 17 '18 at 10:48
add a comment |
I am giving you the exact code and path please copy and paste the below file.
app/code/Inchoo/Helloworld/registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Inchoo_Helloworld',
__DIR__
);
app/code/Inchoo/Helloworld/Block/Adminhtml/Index/Index.php
<?php
namespace InchooHelloworldBlockAdminhtmlIndex;
class Index extends MagentoBackendBlockWidgetContainer
public function __construct(MagentoBackendBlockWidgetContext $context,array $data = [])
parent::__construct($context, $data);
app/code/Inchoo/Helloworld/Controller/Adminhtml/Index/Index.php
<?php
namespace InchooHelloworldControllerAdminhtmlIndex;
class Index extends MagentoBackendAppAction
public function execute()
$this->_view->loadLayout();
$this->_view->getLayout()->initMessages();
$this->_view->renderLayout();
?>
app/code/Inchoo/Helloworld/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Inchoo_Helloworld" setup_version="1.0.0"></module>
<sequence>
<module name="Magento_Backend"/>
<module name="Magento_Sales"/>
<module name="Magento_Quote"/>
<module name="Magento_Checkout"/>
</sequence>
</config>
app/code/Inchoo/Helloworld/etc/adminhtml/routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd">
<router id="admin">
<route id="helloworld" frontName="helloworld">
<module name="Inchoo_Helloworld" before="Magento_Adminhtml" />
</route>
</router>
</config>
app/code/Inchoo/Helloworld/etc/adminhtml/menu.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Magento/Backend/etc/menu.xsd">
<menu>
<add id="Inchoo_Helloworld::parent" title="Helloworld" module="Inchoo_Helloworld" sortOrder="100" resource="Inchoo_Helloworld::parent"/>
<add id="Inchoo_Helloworld::index" title="Helloworld Index" module="Inchoo_Helloworld" sortOrder="10" action="helloworld/index" resource="Inchoo_Helloworld::index" parent="Inchoo_Helloworld::parent"/>
</menu>
</config>
app/code/Inchoo/Helloworld/view/adminhtml/layout/helloworld_index_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<head>
<title>Hello World</title>
</head>
<body>
<referenceContainer name="content">
<block class="InchooHelloworldBlockAdminhtmlIndexIndex" name="helloworld_block_adminhtml_index_index" template="Inchoo_Helloworld::helloworld_index_index.phtml" />
</referenceContainer>
</body>
</page>
app/code/Inchoo/Helloworld/view/adminhtml/templates/helloworld_index_index.phtml
<?php echo "Hello World template"; ?>
N:B After put all the files to the specific path don't forget to run this command from CLI -
php bin/magento setup:upgrade
php bin/magento cache:flush
I am giving you the exact code and path please copy and paste the below file.
app/code/Inchoo/Helloworld/registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Inchoo_Helloworld',
__DIR__
);
app/code/Inchoo/Helloworld/Block/Adminhtml/Index/Index.php
<?php
namespace InchooHelloworldBlockAdminhtmlIndex;
class Index extends MagentoBackendBlockWidgetContainer
public function __construct(MagentoBackendBlockWidgetContext $context,array $data = [])
parent::__construct($context, $data);
app/code/Inchoo/Helloworld/Controller/Adminhtml/Index/Index.php
<?php
namespace InchooHelloworldControllerAdminhtmlIndex;
class Index extends MagentoBackendAppAction
public function execute()
$this->_view->loadLayout();
$this->_view->getLayout()->initMessages();
$this->_view->renderLayout();
?>
app/code/Inchoo/Helloworld/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Inchoo_Helloworld" setup_version="1.0.0"></module>
<sequence>
<module name="Magento_Backend"/>
<module name="Magento_Sales"/>
<module name="Magento_Quote"/>
<module name="Magento_Checkout"/>
</sequence>
</config>
app/code/Inchoo/Helloworld/etc/adminhtml/routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd">
<router id="admin">
<route id="helloworld" frontName="helloworld">
<module name="Inchoo_Helloworld" before="Magento_Adminhtml" />
</route>
</router>
</config>
app/code/Inchoo/Helloworld/etc/adminhtml/menu.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Magento/Backend/etc/menu.xsd">
<menu>
<add id="Inchoo_Helloworld::parent" title="Helloworld" module="Inchoo_Helloworld" sortOrder="100" resource="Inchoo_Helloworld::parent"/>
<add id="Inchoo_Helloworld::index" title="Helloworld Index" module="Inchoo_Helloworld" sortOrder="10" action="helloworld/index" resource="Inchoo_Helloworld::index" parent="Inchoo_Helloworld::parent"/>
</menu>
</config>
app/code/Inchoo/Helloworld/view/adminhtml/layout/helloworld_index_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<head>
<title>Hello World</title>
</head>
<body>
<referenceContainer name="content">
<block class="InchooHelloworldBlockAdminhtmlIndexIndex" name="helloworld_block_adminhtml_index_index" template="Inchoo_Helloworld::helloworld_index_index.phtml" />
</referenceContainer>
</body>
</page>
app/code/Inchoo/Helloworld/view/adminhtml/templates/helloworld_index_index.phtml
<?php echo "Hello World template"; ?>
N:B After put all the files to the specific path don't forget to run this command from CLI -
php bin/magento setup:upgrade
php bin/magento cache:flush
answered Jan 17 '18 at 9:10
Soumik RanaSoumik Rana
1577
1577
My Pleasure..... @ Vivek. Feel free to like this answer.
– Soumik Rana
Jan 17 '18 at 10:48
add a comment |
My Pleasure..... @ Vivek. Feel free to like this answer.
– Soumik Rana
Jan 17 '18 at 10:48
My Pleasure..... @ Vivek. Feel free to like this answer.
– Soumik Rana
Jan 17 '18 at 10:48
My Pleasure..... @ Vivek. Feel free to like this answer.
– Soumik Rana
Jan 17 '18 at 10:48
add a comment |
First correct your folder structure name, Like
Inchoo
Helloworld
-Block
-Adminhtml
Helloworld.php
-Controller
-Adminhtml
-Index
-Index.php
-etc
-module.xml
-adminhtml
-menu.xml
-routes.xml
-view
-adminhtml
-layout
-helloworld_index_index.xml
-templates
-helloworld.phtml
-registration.php
hi rishabh, i corrected the structure like updated in the question but still not working.
– Vivek Xavier
Jan 17 '18 at 8:11
add a comment |
First correct your folder structure name, Like
Inchoo
Helloworld
-Block
-Adminhtml
Helloworld.php
-Controller
-Adminhtml
-Index
-Index.php
-etc
-module.xml
-adminhtml
-menu.xml
-routes.xml
-view
-adminhtml
-layout
-helloworld_index_index.xml
-templates
-helloworld.phtml
-registration.php
hi rishabh, i corrected the structure like updated in the question but still not working.
– Vivek Xavier
Jan 17 '18 at 8:11
add a comment |
First correct your folder structure name, Like
Inchoo
Helloworld
-Block
-Adminhtml
Helloworld.php
-Controller
-Adminhtml
-Index
-Index.php
-etc
-module.xml
-adminhtml
-menu.xml
-routes.xml
-view
-adminhtml
-layout
-helloworld_index_index.xml
-templates
-helloworld.phtml
-registration.php
First correct your folder structure name, Like
Inchoo
Helloworld
-Block
-Adminhtml
Helloworld.php
-Controller
-Adminhtml
-Index
-Index.php
-etc
-module.xml
-adminhtml
-menu.xml
-routes.xml
-view
-adminhtml
-layout
-helloworld_index_index.xml
-templates
-helloworld.phtml
-registration.php
answered Jan 17 '18 at 7:30
Rishabh Rk RaiRishabh Rk Rai
378214
378214
hi rishabh, i corrected the structure like updated in the question but still not working.
– Vivek Xavier
Jan 17 '18 at 8:11
add a comment |
hi rishabh, i corrected the structure like updated in the question but still not working.
– Vivek Xavier
Jan 17 '18 at 8:11
hi rishabh, i corrected the structure like updated in the question but still not working.
– Vivek Xavier
Jan 17 '18 at 8:11
hi rishabh, i corrected the structure like updated in the question but still not working.
– Vivek Xavier
Jan 17 '18 at 8:11
add a comment |
i was also facing the same issue Magento 2.3 CE. I gave the proper permissions for var and pub directories and ran the following commands-
- provided file permission for var/ and pub/
- setup:upgrade
- setup:static-content:deploy -f
- cache:flush
and it started to work.
add a comment |
i was also facing the same issue Magento 2.3 CE. I gave the proper permissions for var and pub directories and ran the following commands-
- provided file permission for var/ and pub/
- setup:upgrade
- setup:static-content:deploy -f
- cache:flush
and it started to work.
add a comment |
i was also facing the same issue Magento 2.3 CE. I gave the proper permissions for var and pub directories and ran the following commands-
- provided file permission for var/ and pub/
- setup:upgrade
- setup:static-content:deploy -f
- cache:flush
and it started to work.
i was also facing the same issue Magento 2.3 CE. I gave the proper permissions for var and pub directories and ran the following commands-
- provided file permission for var/ and pub/
- setup:upgrade
- setup:static-content:deploy -f
- cache:flush
and it started to work.
answered Apr 15 at 18:48
kaushik kumar roykaushik kumar roy
329
329
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f209739%2fmagento2-sample-custom-admin-module-showing-blank-page%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
have you run deploy and cache flush command from cli
– Bachcha Singh
Jan 17 '18 at 8:43
Hi Bachcha Singh, tried but no luck.
– Vivek Xavier
Jan 17 '18 at 9:27