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>



62.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.phalconphp.com/en/latest/api/Phalcon%5Tag.html