示例#1
0
{
    function __construct($m)
    {
        parent::__construct($m, self::SELF_FIRST);
    }
    function beginChildren()
    {
        echo str_repeat("\t", $this->getDepth());
    }
    function endChildren()
    {
        echo str_repeat("\t", $this->getDepth() - 1);
    }
}
$root = sfBreadNavPeer::getRoot($scope);
$menu = sfBreadNavPeer::retrieveTree($scope);
$menu = new myMenuOutput($menu);
function bool2string($bool)
{
    if (!is_null($bool)) {
        return 'On';
    }
    return ' ';
}
?>

<br/>
    <table style='border-spacing: 0px 0px; border-style: none; border-collapse: collapse;' id="breadnavtreetable">
      <tr class='odd'><strong><td>PAGE NAME</td><td>MODULE</td><td>ACTION</td><td>CREDENTIAL</td><td>CATCH ALL</td></strong></tr>
      <tr class='even'>
       <td><a href="<?php 
示例#2
0
<?php 
class myMenuOutput extends RecursiveIteratorIterator
{
    function __construct(sfBreadNav $m)
    {
        parent::__construct($m, self::SELF_FIRST);
    }
    function beginChildren()
    {
        echo str_repeat("\t", $this->getDepth());
    }
    function endChildren()
    {
        echo str_repeat("\t", $this->getDepth() - 1);
    }
}
$menu = sfBreadNavPeer::retrieveTree(1);
$it = new myMenuOutput($menu);
foreach ($it as $m) {
    echo $m->getPage(), '[', $m->getLeftValue(), '-', $m->getRightValue(), "]\n", $m->getLevel(), "<br>";
}