Symfony1 Symfony 1.4模块路径

Symfony1 Symfony 1.4模块路径,symfony1,symfony-1.4,Symfony1,Symfony 1.4,以下结构: apps/backend/ apps/frontend/ modules/ account/template/_menu.php account/template/test.php settings/template/indexSuccess.php 我确实在test.php中包含了_菜单,其中包含以下代码: <?php slot(

以下结构:

apps/backend/
apps/frontend/
             modules/
                    account/template/_menu.php
                    account/template/test.php
                    settings/template/indexSuccess.php
我确实在test.php中包含了_菜单,其中包含以下代码:

<?php slot('menu'); ?>
<?php include(dirname(__FILE__).'/_menu.php') ; ?>
<?php end_slot() ?>

如何将文件_menu.php包含在indexSuccess.php中? 谢谢


Gunnar

您想使用indexSuccess.php模板中的
include_partial

// indexSuccess.php
// Use the array container to pass values available in indexSuccess to your partial
<?php include_partial('menu', array(
    'foo' => $foo,
    'bar' => $bar 
)) ?>
//indexSuccess.php
//使用数组容器将indexSuccess中可用的值传递给部分

您可以在中阅读更多信息。

您不需要这样做,Symfony将在/apps/app\u name/templates(全局)或/apps/app\u name/modules/module\u name/templates中查找其中一个位置。因此,您所需要做的就是确保您的部分(用“_”表示)位于这两个位置之一。