0

I am working with the magento(1.9), i changed my home page design using the cms block see below the code.

<reference name="content">
    <block type="core/template" template="federallawyer/topmenu/home/page.phtml">
        <block type="fljob/jobs_list"  name="home_jobs_list"  template="federallawyer/fljob/jobs/home/list.phtml"/>
    </block>
</reference>

I can see that page.phtml is get used in my page, but not my custom home_jobs_list child block.

I called that child block in page.phtml like this.

$this->getChildHtml('home_jobs_list')
  • do you have block (fljob/jobs_list.php) in your custom extension? – Adarsh Khatri Jun 22 '15 at 5:23
  • yes i have it the mention block file in the job module – senthil Jun 23 '15 at 4:02
2

Two things to note.

1. Make sure your custom block does exist.

As per your layout update, this is your custom block definition.

 <block type="fljob/jobs_list"  name="home_jobs_list"  template="federallawyer/fljob/jobs/home/list.phtml"/>

So in order to load this block, the block type fljob/jobs_list should be defined in your module. So your block should be somthing like this.

File : app/code/<your_moudule's_codePool>/Namespace/Module/Block/Jobs/List.php

<?php
class Namespace_Module_Block_Jobs_List extends Mage_Core_Block_Template
{
}

2. You should set an alias name for your custom block.

This is how an alias name is provide to your block.

<block type="fljob/jobs_list"  name="home_jobs_list"  as="jobs_list" template="federallawyer/fljob/jobs/home/list.phtml"/>

Alias name of block is what you should refer in page.phtml. So in the above case, since we are set an alias name jobs_list, this is how you can call your custom block inside page.phtml.

<?php echo $this->getChildHtml('jobs_list'); ?>

Last but not least, you should clear all cache and then load the page again. Miracle will happen. You have my word on it. :-)

  • i create a new module with the name of "fljob", then as per your answer i have everything (block and the corresponding .phtml file), but still the child html in not get load. – senthil Jun 22 '15 at 13:12
  • show ur config.xml file – Rajeev K Tomy Jun 22 '15 at 14:19
0
<reference name="content">
   <block type="core/template" template="federallawyer/topmenu/home/page.phtml" name="home_jobs_list" />
</reference>

And see here How do I add a block on the home page above the content, below the navigation on the home page only?

0

If you have your custom_block then in your layout xml file:

<reference name="content">
     <block type="fljob/jobs_list" name="home_jobs_list"  template="federallawyer/fljob/jobs/home/list.phtml"/>
</reference>

I have removed federallawyer/topmenu/home/page.phtml assuming you can call all needed in your list.phtml.

If you don't have your custom block

To render your phtml file in cms page.

{{block type="core/template" template="federallawyer/fljob/jobs/home/list.phtml"}}

Your file must be as follow: frontend/your_theme_pack/theme_name/federallawyer/fljob/jobs/home/list.phtml

Here, you can only call any function found in Mage_Core_Block_Template.

If you are trying to call any other or custom functions inside your list.phtml file, then will need to create extension.

  • I have updated my answer, please check. – Adarsh Khatri Jun 23 '15 at 4:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.