【发布时间】:2012-06-06 10:13:36
【问题描述】:
在我的 magento 模板中,我在主页中使用了以下代码“getChildHtml('content')”。它在哪里使用模板文件中的 getChildHtml() 加载内容?
【问题讨论】:
标签: magento
在我的 magento 模板中,我在主页中使用了以下代码“getChildHtml('content')”。它在哪里使用模板文件中的 getChildHtml() 加载内容?
【问题讨论】:
标签: magento
您可以在 page.xml 中找到您页面的全局结构。例如,如果您可以使用 3 列
<default translate="label" module="page">
<label>All Pages</label>
<block type="page/html" name="root" output="toHtml" template="page/3columns.phtml">
....
然后,在您的设计主题的模板页面/3columns.phtml 中,您可以看到此 phtml,并且您可以在其中看到:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">
<head>
<?php echo $this->getChildHtml('head') ?>
</head>
<body<?php echo $this->getBodyClass()?' class="'.$this->getBodyClass().'"':'' ?>>
<?php echo $this->getChildHtml('after_body_start') ?>
<div class="wrapper">
<?php echo $this->getChildHtml('global_notices') ?>
<div class="page">
<?php echo $this->getChildHtml('header') ?>
<div class="main-container col3-layout">
<div class="main">
<?php echo $this->getChildHtml('breadcrumbs') ?>
<div class="col-wrapper">
<div class="col-main">
<?php echo $this->getChildHtml('global_messages') ?>
<?php echo $this->getChildHtml('content') ?>
</div>
<div class="col-left sidebar"><?php echo $this->getChildHtml('left') ?></div>
</div>
<div class="col-right sidebar"><?php echo $this->getChildHtml('right') ?></div>
</div>
</div>
<?php echo $this->getChildHtml('footer') ?>
<?php echo $this->getChildHtml('before_body_end') ?>
</div>
</div>
<?php echo $this->getAbsoluteFooter() ?>
</body>
</html>
使用 getChildHtml('content') ?>。 这能解决您的问题吗?
【讨论】: