Question

here is my code below of my module.config page

'router' => array(
    'routes' => array(
        'album' => array(
            'type'    => 'segment',
            'options' => array(
                'route'    => '/photos[/:action][/:id]',
                'constraints' => array(
                    'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                    'id'     => '[0-9]+',
                ),
                'defaults' => array(
                    'controller' => 'Photos\Controller\Photos',
                    'action'     => 'index',
                ),
            ),
        ),
    ),
),

and in my controller page

public function uploadAction()
{

    //die('uploading page');
  $this->layout('layout/index');

    return array();
}

die works fine

my front end page code is

this is the page iam trying to link to any other pages.....

 `<?php echo $this->url('photos',array('action' => 'upload_done')); ?>`

iam getting an error

Fatal error: Uncaught exception 'Zend\Mvc\Router\Exception\RuntimeException' with message 'Route with name "photos" not found' in

Was it helpful?

Solution

Try this.

<?php echo $this->url('album',array('action' => 'upload_done')); ?>

The url plugin takes the name of the route, which in your example is "album" despite the url route being "photos"

(You could also rename the route as "photos" and stick with your original url plugin example)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top