S
S
Sergey2016-02-16 22:03:23
Yii
Sergey, 2016-02-16 22:03:23

How to use the breadcrumb widget correctly?

There are two types say parent and child in the parent I use breadcrumbs so
$this->params['breadcrumbs'][] = $this->title;
where $this->title is the title of the page (there may be many and not known in advance) the question is how can I use breadcrumbs in child so that the first link would come title parent c which the user has passed and a link to it.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
snizhok, 2016-02-16
@snizhok

The question is a little vague. But if I correctly understood the question itself, then you need to organize the logic so that each child knows its parent. Then, by iterating in the parent cycle, you can output the entire chain into breadcrumbs.

A
Alexander, 2016-02-18
@p0vidl0

Use URL Remember .
Quote from the docs:
There are tasks where you need to remember the URL and then use it in the course of one or more subsequent requests. This can be achieved like this:

// Запомнить текущий URL
Url::remember();

// Запомнить определенный URL. Входные параметры смотрите на примере Url::to().
Url::remember(['product/view', 'id' => 42]);

// Запомнить URL под определенным именем
Url::remember(['product/view', 'id' => 42], 'product');

In the following request, we can get the saved URL like this:
$url = Url::previous();
$productUrl = Url::previous('product');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question