Magento 1.9 – How to Call PHTML File

magento-1.9phtml

I want to call show.phtml file which will print database records from entry.phtml file.Here is the code of my files having-

show.phtml

<?php
 $model=Mage::getModel('entry/entry')->getCollection()->getData();
 echo "<pre>";
 print_r($model);
 exit();

 ?>

entry.phtml

<h1>HELLO</h1>
<form enctype="multipart/form-data" method="post" action="<?php echo $this->getBaseUrl().'entry/index/save' ?>">
    <input type="text" name="name" placeholder="Enter Name">
    <input type="text" name="email" placeholder="Enter Email">
    <input type="text" name="mobile" placeholder="Enter Mobile">
    <input type="submit" value="Enter">

</form>

Best Answer

You can call your phtml file in another phtml file as below

<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('module-folder-name/show.phtml')->toHtml() ?> 

But if you want to show your phtml file from controller as you commented below my answer, you can call it as below.

Create a phtml file

app/design/frontend/your/theme/template/module/show.phtml

<?php
 $model=Mage::getModel('entry/entry')->getCollection()->getData();
 echo "<pre>";
 print_r($model);
 exit();

 ?>

Create an xml file

app/design/frontend/your/theme/layout/module.xml

<?xml version="1.0"?>   
<layout version="0.1.0">   
  <module_index_index>   
    <reference name="root">   
      <action method="setTemplate"><template>page/1column.phtml</template></action>   
    </reference>   
    <reference name="content">   
      <block type="module/index" name="module_index" template="module/show.phtml"/>   
    </reference>   
  </module_index_index>   
</layout>   

Create a controller file

app/code/local/Vendor/Module/controllers/IndexController.php

<?php
class Vendor_Module_IndexController extends Mage_Core_Controller_Front_Action{
    public function IndexAction() {

    $this->loadLayout();   
    $this->renderLayout(); 

    }
}