-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Advanced usage: generate links on tags #9
Comments
What is the best way to get tags slugs in a view to bypass them in URL? |
@a-komarev As i remember we discuss that already. The best way to do that: <?php foreach ($model->tags as $tag) : ?>
<?= Html::a($tag, ['/tag/view', 'tag' => $tag->slug]) ?>
<?php endforeach ?> |
@creocoder Sorry, looks like I forgot a details. The correct example will be: <?php foreach ($model->tags as $tag) : ?>
<?= Html::a($tag->name, ['/tag/view', 'tag' => $tag->slug]) ?>
<?php endforeach ?> Because |
Just realized that all search functions of Thats solving in Model which using [
'class' => TaggableBehavior::className(),
'tagNameAttribute' => 'slug',
], Thanks, Alexander, for flexibility :} |
My bad. Another problem rising. If you are setting |
Here is a quick solution for |
Here is how I'm using tags without SluggableBehavior.
In application config:
In view file:
If we have a tag
tag with whitespace
we will have a generated link:/tag/tag+with+whitespace
This link will call
TagController:actionView()
method and bypasstag
parameter inYii::$app->request->queryParams
array.The text was updated successfully, but these errors were encountered: