4

i have a link (href) to another site but i have problem

this is my code :

          return Html::a('Create More', ["https://face.com/"], ['class' => 'btn btn-primary', 'role' => 'modal-remote']);
       

why my link is a new action? i want change my baseurl to https://face.com/ but dosnt work

this is my new link:

https://niniplus.com/newadmin/index.php/https://face.com
Saltern
  • 1,305
  • 2
  • 16
  • 42

3 Answers3

9

By just removing the array ["https://face.com/"], an absolute url will be return.

return Html::a('Create More', "https://face.com/", ['class' => 'btn btn-primary', 'role' => 'modal-remote']);
vher2
  • 980
  • 6
  • 9
1

If you want to use an absolute url you can call yii\helpers\Url::to() yourself, before passing the URL to this method, like this:

return Html::a('Create More', Url::to('https://face.com/', true), ['class' => 'btn btn-primary', 'role' => 'modal-remote']);
Parth Shah
  • 346
  • 1
  • 6
1

You need to add use yii\helpers\Url; into view and you should write your anchor tag like below:

return Html::a('Create More',  Url::to('https://face.com/', true), ['class' => 'btn btn-primary', 'role' => 'modal-remote']);
Mayank Vadiya
  • 1,437
  • 2
  • 19
  • 32