Skip to content

Commit 01e3924

Browse files
committed
Create Topmenu.php
1 parent aec086f commit 01e3924

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Topmenu.php

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
ini_set('display_startup_errors', 1);ini_set('display_errors', 1); error_reporting(-1);
4+
5+
$file = dirname(__FILE__) . '/app/bootstrap.php';
6+
$file = str_replace('/pub/', '/', $file);
7+
require $file;
8+
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
9+
10+
11+
class MagentoCLI extends \Magento\Framework\App\Http
12+
implements \Magento\Framework\AppInterface {
13+
14+
public function launch()
15+
{
16+
$this->_state->setAreaCode('frontend');
17+
18+
$time_start = microtime(true);
19+
20+
21+
$menu = $this->_objectManager->create('\Magento\Theme\Block\Html\Topmenu');
22+
$menu->setTemplate('html/topmenu.phtml');
23+
$html = $menu->toHtml();
24+
echo $html;
25+
26+
$time_end = microtime(true);
27+
28+
//dividing with 60 will give the execution time in minutes otherwise seconds
29+
$execution_time = ($time_end - $time_start)/60;
30+
31+
echo 'Execution time ' . $execution_time;
32+
return $this->_response;
33+
}
34+
35+
}
36+
37+
/** @var \Magento\Framework\App\Http $app */
38+
$app = $bootstrap->createApplication('MagentoCLI');
39+
$bootstrap->run($app);

0 commit comments

Comments
 (0)