Reputation: 530
I'm trying to create a custom Magento page for my module that is completely blank with only one string in the output. The page cannot have HTML tags like <html>
, <body>
and <head>
.
I need this to make a API integration with Facebook, which scrap the page content to check if a string is valid, so I can't have any HTML code, only pure plain text.
Code so far: Controller:
public function facebookAction()
{
$this->loadLayout();
$this->renderLayout();
}
View:
<?php
$action = $this->getRequest()->getActionName();
echo Mage::getModel('chatbot/chatdata')->requestHandler($action);
?>
Now it's showing the string I want, but with HTML tags. If I remove the loadLayout and renderLayout, then it shows nothing.
How can I accomplish that?
Upvotes: 2
Views: 721
Reputation: 365
You can call a different template from your controller action using
public function facebookAction()
{
$this->loadLayout();
$this->getLayout()->getBlock('root')->setTemplate('page/yourtemplate.phtml');
$this->renderLayout();
}
This overwrites the "root" node from your layout XML and replaces it with your own template.
Upvotes: 1
Reputation: 672
you can remove diffrent section from your custom page using xml like this.
<reference name="root">
<remove name="header"/>
<remove name="content"/>
<remove name="footer"/>
</reference>
Then you can add your custom code in your phtml file.
Upvotes: 1