Aviator
Aviator

Reputation: 25

Yii2 Url Html format

Quick Question:

i use following code in my View Script to generate a link

<?=HTML::a("(".$player['player']->steam_id_32.")",['steam/','steamid'=>$player['player']->steam_id_32])?>

This is going to return following link

/web/steam/STEAM_0%3A0%3A96553432

how can i have it return

/web/steam/STEAM_0:0:96553432

i tried some thing but could not figure it out thank you

Upvotes: 2

Views: 6693

Answers (1)

Jap Mul
Jap Mul

Reputation: 18769

This behavior is by design. You can't really change this behavior, but you could use a workaround.

The code below first creates the url and then decodes it. Then create the link (<a>) with the previous created url.

$url = urldecode(Url::toRoute(['steam/', 'steamid' => 'aa:bb:cc']));
echo Html::a('title', $url);

Upvotes: 4

Related Questions