Quantcast
Channel: BSOURCECODE
Viewing all articles
Browse latest Browse all 10

Breadcrumbs Widget In Yii Framework1.0

$
0
0

CBreadcrumbs displays a list of links indicating the position of the current page in the whole website.
For Example

Home > Employee > admin

Default Breadcrumbs

To use CBreadcrumbs, one usually needs to configure its links property, which specifies the links to be displayed. For example,

<?php if(isset($this-gt;breadcrumbs)):?>
	<?php 	$this-gt;widget('zii.widgets.CBreadcrumbs', array(
				'links'=>$this-gt;breadcrumbs,
			)); ?>
<?php endif?>

OUTPUT HTML

	<div class="breadcrumbs">
		 » Languages
	</div>
		<?php $this-gt;widget('zii.widgets.CBreadcrumbs', array(
			'links'=>$this-gt;breadcrumbs,
			 'homeLink'=>false,
		)); ?>
	<?php endif?>

OUTPUT HTML

	<div class="breadcrumbs">
		<span>Languages</span>
	</div>

Breadcrumb Array

<?php
$this-gt;breadcrumbs=array(
	'Employees'=>array('index'),
	'Create',
);
?>
<?php if(isset($this-gt;breadcrumbs)):?>
		<?php $this-gt;widget('zii.widgets.CBreadcrumbs', array(
				'links'=>$this-gt;breadcrumbs,
				'tagName'=>'ul',
				'homeLink'=>false,
				'activeLinkTemplate'=>'<li><a href="{url}">{label}</a></li>',
				'inactiveLinkTemplate'=>'<li><span>{label}</span></li>',
				'separator'=>'',
		)); ?><!-- breadcrumbs -->
	<?php endif?>

OUTPUT HTML

>ul class="breadcrumbs">
	>li>>a href="/project/index.php?r=employee/index">Employees</a></li>
	>li><span>Create</span></li>
>/ul>
<?php 
$this-gt;widget('zii.widgets.CBreadcrumbs',array(
    'links'=>array(
        Yii::t('ui','Employee')=>array('employee/create'),
        Yii::t('ui','Create')
    )
));
?>
[OR]
<?php
$this-gt;widget('zii.widgets.CBreadcrumbs', array(
    'links'=>array(
        'Employee'=>array('employee/create'),
        'Create',
    ),
));
?>

OUTPUT HTML

<div class="breadcrumbs">
	<a href="/project/index.php">Home</a> » 
	<a href="/project/index.php?r=employee/create">Employee</a> » <span>Create</span>
</div>

Viewing all articles
Browse latest Browse all 10

Trending Articles