How to call Controller Action into Magento PHTML file

magento

In Some cases for some customization we need to call controller action manually.
It always loads when url has been called into the browser.
But in some cases we can call controller action into phtml file and load its content where ever we need it.
So if you are in above case please check or use below code into your phtml file to load the content of Controller.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Example for Loading Controller Action into PHTML File</title>
</head>
<body>
<?php

    $layout = $this->getLayout();
    $update = $layout->getUpdate();
    $update->load('modulename_cintrollername_action');
    $layout->generateXml();
    $layout->generateBlocks();
    $output = $layout->getOutput();
    echo $output;

?>
</body>
</html>
Posted in Uncategorized