O
O
Oleg Batishchev2013-05-07 09:09:06
PHP
Oleg Batishchev, 2013-05-07 09:09:06

Custom Nested Blocks in Magento

I'm trying to implement childBlock in the main one in different ways. But in any case, it displays a set of some unreadable characters on the screen. What is it all about? Has anyone experienced this?
image
I just don't understand what's going on, any way produces such a result.

Method 1 directly in the template

$this->getLayout()->createBlock('core/template','template_name')->setTemplate('path/to/template.phtml'))->toHtml();


Method 2 in layout
<block type="module/block" name="view" template="path/to/template.phtml">
    <block type="module/block_question" name="view_question" as="question" template="path/to/subtemplate.phtml"/>
</block>

Accordingly in the template path/to/template.phtml
<?php echo $this->getChildHtml('question'); ?>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg Batishchev, 2013-05-16
@z0rg

In general, the behavior is not clear when the time will definitely need to be picked. But the meaning is something like this, trying to treat some objects or their methods as a different data type.

D
Doktor_Gradus, 2013-05-07
@Doktor_Gradus

Is caching disabled? Do the template file encodings match?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question