We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

how to put another html attributes in link_to

how to put another html attributes in link_to method because like for example i have html tags <a href="#">Link to another <i class="glyphicon glyphicon-user"></i> </a>



2.1k

try escaping the quotes



33.8k
Accepted
answer

So you want something like this?

<a href='#' class='myClass' id='myId'>
    Link to another
    <i class='glyphicon glyphicon-user'></i>
</a>

Just do:

Phalcon\Tag::linkTo(
    '#',
    "Link to another<i class='glyphicon glyphicon-user'></i>",
    ['class' => 'myClass', 'id' => 'myId']
);

https://docs.phalcon.io/es/latest/api/Phalcon_Tag.html

So you want something like this?

<a href='#' class='myClass' id='myId'>
   Link to another
   <i class='glyphicon glyphicon-user'></i>
</a>

Just do:

Phalcon\Tag::linkTo(
   '#',
  "Link to another<i class='glyphicon glyphicon-user'></i>",
  ['class' => 'myClass', 'id' => 'myId']
);

https://docs.phalcon.io/es/latest/api/Phalcon_Tag.html

thank you for your help :) its nice and concise