We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

How to pass array attribute to Phalcon\Tag linkTo

Hi All, I need a function created linkTo instead: linkTo([$a, $b, 'title'=>'tt', 'class' => 'tty']);

I want pass array for attribute: same:

$a = 'link'; $b = 'title'; $c = [ 'title'=>'tt', 'title'=>'tty' ];

$tag = new Tag(); return $tag->linkTo([$a, $b, $c]);

It's only show: <a href="link">title</a>



93.7k
Accepted
answer
edited Mar '16

Hello,

// Volt
{{ linkTo(['LINK_HERE', 'TEXT_HERE', 'class': 'red', 'target': '_blank']) }}
// Produces
<a href="http://localhost/LINK_HERE" class="red" target="_blank">TEXT_HERE</a>

// PHP templates
echo Phalcon\Tag::linkTo(array("signup/register", "Register Here!", "class" => "btn-primary"));

More info: https://docs.phalcon.io/en/latest/api/Phalcon_Tag.html