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

Phalcon\Tag isn't working as expected

Hi! I have a problem with generating links using Phalcon\Tag. I have configured routing component using DI so that I have named route.

<?php
...
    $di->set('router', function () {
        $router = new \Phalcon\Mvc\Router();

        //Define a route
        $router->add('/signup', ['controller' => 'auth', 'action' => 'signup'])->setName('registration');

        return $router;
    });

But when I try to create link for a named route as in the tutorial

<?= Tag::linkTo(['for' => 'registration'], 'Registration') ?>

I get this:

<a for="registration" href="https://localhost/"></a>

Is that a bug? Or I'm doing something wrong?



98.9k

hi, the link must be:

<?= Tag::linkTo([['for' => 'registration'], 'Registration']) ?>


416

Thanks for reply! It is all working correctly now!