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