I\'m using Magento.
I want display and call one phtml
file as a link in another phtml
file…
I have the new.phtml
file on t
you call newproductpage.phtml in any phtml file using below code
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('custom/newproductpage.phtml')->toHtml(); ?>
Use the below code for rendering your phtml file in another phtml file.
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('templatefolderpath/filename.phtml')->toHtml(); ?>
For more refinement of your code, you can use the block name and block file name instead of core/template because core/template use the core resources.
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('catalog/product/new.phtml')->toHtml(); ?>
you can also check the link.
Display .phtml page in another .phtml page
You can not call directly one phtml file to another phtml file.
But there are two way to call your phtml file either create one controller and create one action and call action from your anchor tag or create one cms page which call your phtml file.
if you create one module, so in your layout file something you can write
<modulename_controllername_controlleraction>
<reference name="content">
<block type="catalog/product_new" template="custom/newproductpage.phtml" />
</reference>
</module_controllername_controlleraction>
Or you can directly put this code in your cms page content area
{{block type="catalog/product_new" template="custom/newproductpage.phtml"}}
and in anchor tag give cms page link.
I believe you and I want to do precisely the same thing. I'm creating a modal from bootstrap and I need to call in a partial using the href attr.
So far, I think this might be possible by creating a page in the CMS and then using something like this:
<li><a href="<?php echo $this->getUrl("page-name-in-CMS") ?>">Home</a></li>
But honestly, I'm just starting out with Magento and know very little.
you can use iframe for same and load this another page content using AJAX call