By admin |

theme links使用实例:

$links =  array(
  'item1' => array( 'title' => '1st Item', 'href' => 'path/one' , 'attributes' => array()),
  'item2' => array( 'title' => '2nd Item', 'href' => 'path/two' , 'attributes' => array()),
);
$vars = array(
  'links' => $links, 
  'attributes' => array('class' => 'outclass')
);
print theme('links', $vars);

 执行以上,将会输出如下结果:

<ul class="outclass list-paddingleft-2">
    <li>
        <p>
            <a href="/path/one">1st Item</a>
        </p>
    </li>
    <li>
        <p>
            <a href="/path/two">2nd Item</a>
        </p>
    </li>
</ul>