2

i'm install news module, and want to show latest news on main page in cms page content. In the module xml i'm find

 <reference name="right">
            <block type="clnews/settings" name="right.clnews.menu" before="-">
                <action method="setTemplate" ifconfig="clnews/news/showrightblock">
                    <template>clnews/menu.phtml</template>
                </action>
            </block>
            <block type="clnews/news" name="right.clnews.latest" after="right.clnews.menu">
                <action method="setTemplate" ifconfig="clnews/news/showlatestnews">
                    <template>clnews/latest.phtml</template>
                </action>
            </block>
        </reference>

in the end of file i added

<cms_index_index>

     <block type="clnews/news" name="right.clnews.latest">
                <action method="setTemplate" ifconfig="clnews/news/showlatestnews">
                    <template>clnews/latest.phtml</template>
                </action>
            </block>

</cms_index_index>

in cms page i wrote

{{block type="clnews/news" name="right.clnews.latest" template="clnews/latest.phtml"}}

but in main page i d'not see my block, what the problem?

p/s latest news config is enable

5
  • {{block type="clnews/news" name="right.clnews.latest" template="clnews/latest.phtml" ifconfig="clnews/news/showlatestnews" }} try this
    – Amit Bera
    Apr 6, 2015 at 15:56
  • not working:(((
    – user2842
    Apr 6, 2015 at 16:08
  • did you find a solution to this?
    – Jimmery
    Sep 17, 2015 at 10:21
  • Did you whitelist that block type? You can do this via System > Permissions > Blocks. Apr 28, 2016 at 6:30
  • Please try to keep the block name different in cms home page then define in xml. Jun 17, 2016 at 13:51

2 Answers 2

1

You need to wrap your block inside content block. ie.

<cms_index_index>
   <reference name="content">
       <block type="clnews/news" name="right.clnews.latest">
           <action method="setTemplate" ifconfig="clnews/news/showlatestnews">
               <template>clnews/latest.phtml</template>
           </action>
       </block>
    </reference>
</cms_index_index>

Then clear your cache and you are good to go.

Another alternative solution is, add your block in content area using block directive via backend. Like this.

{{block type="clnews/news" name="right.clnews.latest" template="clnews/latest.phtml" ifconfig="clnews/news/showlatestnews" }}

In this case, please make sure your custom block is whitelisted under System > Permissions > Blocks


[This answer is a part of #mageStackDay5. It is an event conducted by Magento Community members as part of increasing the question-answer ratio. For more information http://www.magestackday.com/]

0

If you use a custom theme, you should copy module files (template .phtml and layout .xml) in your theme.

Copy from default/default/template/clnews folder clnews. And from default/default/layout/clnews.xml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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