Magento:Hello World Page

时间:2011-12-19 10:06:36

标签: php magento

我目前正在涉足Magento,我想知道如何创建一个空白的Hello World文件,同时仍然包括页眉,页脚等。我已阅读How to create a simple 'Hello World' module in Magento? - 但我觉得这对静态来说太过分了页。

我想创建 www.site.com/magentolocation/helloworld.php

我想要一个空白的PHP文件,而不是去模块和MVC方法我不能只做:

<?php
include magconfig;
mag->header;

echo 'hello world' // or other static html

mag->footer;
?>

简单。

1 个答案:

答案 0 :(得分:1)

我确信可能会有一个更漂亮的方式,但这里有一个快速的代码片段:

<?php

require_once ('app/Mage.php');
umask(0);
Mage::app('default');
Mage::getSingleton('core/session', array('name' => 'frontend'));
$Block = Mage::getSingleton('core/layout');
$head = $Block->createBlock('Page/Html_Head');
$head->addCss('css/styles.css');
$head->addJs('prototype/prototype.js');
$header = $Block->createBlock('Page/Html_Header');
$header->setTemplate('page/html/header.phtml');
$footer = $Block->createBlock('Page/Html_Footer');
$footer->setTemplate('page/html/footer.phtml');

?>
<html>
<head>
<?php echo $head->getCssJsHtml(); ?>
</head>
<body>
<?php

    echo $header->toHTML();

    echo 'hello world';

    echo $footer->toHTML();
?>
</body>
</html>
相关问题