圆般 2011-03-24 14:34:31 6257次浏览 17条回复 1 0 0

功能介绍:zii.widgets 下的CBreadcrumbs类,其继承关系: CBreadcrumbs » CWidget » CBaseController » CComponent .源代码位置: framework/zii/widgets/CBreadcrumbs.php CBreadcrumbs displays a list of links indicating the position of the current page in the whole website. 面包屑类显示一个链接列表以表明当前页面在整个网站中的位置. Because breadcrumbs usually appears in nearly every page of a website, the widget is better to be placed in a layout view. 由于面包屑通常会出现在网站的近乎所有的页面,此插件最好在视图的layout中进行部署. One can define a property "breadcrumbs" in the base controller class and assign it to the widget in the layout, like the following: 你可以定义一个breadcrumbs属性并且在布局文件中指派给(网站)基础控制器插件,如下所示:

$this->widget('zii.widgets.CBreadcrumbs', array(
  'links'=>$this->breadcrumbs,
));

Then, in each view script, one only needs to assign the "breadcrumbs" property as needed. 于是乎,你需要时,只需要在每个视图脚本中,指定breadcrumbs属性(就可以显示出网页导航了). 以上是官方提供的文档文件的介绍. 下面介绍视图文件中写法:

$this->breadcrumbs=array(
  'Users'=>array('index'),
  'Create',
  // 形式 :  'key' =>'value'  key的位置相当于最后显示出来的a标签内的名字, value则相当于a标签的href属性.
  // 'Create'表示当前页  故没有设置链接.
);
您需要登录后才可以回复。登录 | 立即注册