Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Slash at the end of a link - Problem with Zend\View\Helper\Url #130

@mano87

Description

@mano87

Hello,
i have integrated two links into a template as follows.

<div class="btn-group" role="group">
    <a class="btn btn-default <?php echo ($this->url() == '/education/student-deregistration') ? 'active' : ''; ?>" href="<?php echo $this->url('education.student-deregistration', ['section' => null]); ?>">Vorklinik</a>
    <a class="btn btn-default <?php echo ($this->url() == '/education/student-deregistration/clinical') ? 'active' : ''; ?>" href="<?php echo $this->url('education.student-deregistration', ['section' => 'clinical']); ?>">Klinik</a>
</div>

And This is my route.

class RouterDelegatorFactory implements DelegatorFactoryInterface
{
    public function __invoke(ContainerInterface $container, $name, callable $callback, array $options = null)
    {
        $application = $callback();
        $application->route('/education/student-deregistration[/{section:clinical|preclinical}]', StudentDeregistrationAction::class, ['GET'], 'education.student-deregistration');
        return $application;
    }
}

Now I have the following problems:

  1. With this configuration the link /education/student-deregistration is always output with a / at the end. This is not work. What can i do?
  2. Is there a more elegant way to check the active link?

@weierophinney @RalfEggert

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions