I am trying to change the reference block of contact us link..I created all the phtml file and all.. Now in Phtml file when i am calling
<?php $_links = $this->getLinks(); ?>
I am getting number of links as 0..because it cant get the object of links.php.. I want to know how can I have reference object of contacts.phtml
Re: How to call phtml file in another phtml fileecho $this->getLayout()->createBlock("Magento\Framework\View\Element\Template")->setTemplate("Magestore_Webpos::login. phtml")->toHtml();
Call phtml using block codelogin to magento admin. Open any cms page and write block code in content section. After using the block code phtml file will be called on cms page. If you want to call phtml file on all cms pages then you can create a layout file to achieve this.
Hi you can do it by creating reference to that Block.Like
$cpBlock = $this->getLayout()->getBlockSingleton('your block class'); //ect Mage_Catalog_Block_Product_List_Toolbar
Than you can easily call every function of that class like $cpBlock->getLinks();
.Other way is using XML block code.Add contact us xml reference just like user2338443 mentioned to your custom xml and than access functions of that block.
block to block calling
Also try call other block class method from current template block class.
$s = Mage::app()->getLayout()->getBlockSingleton('myproductfamily/family');
print_r($s->getCollection($collectionId));exit;
where: myproductfamily = ModuleName
family = blockClass
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With