Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8769425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:20:43+00:00 2026-06-13T17:20:43+00:00

I’m starting developing using Zend Framework and I have a question about routes. Is

  • 0

I’m starting developing using Zend Framework and I have a question about routes. Is there a way to instead of having a URL like this:

http://www.mysite.com/newsletter/groups/edit/id/1

Have this:

http://www.mysite.com/newsletter/groups/edit/1

(without the parameter name id)

I already put this code to declare a custom route in my BootStrap file:

protected function _initRoutes()
{
    $router = Zend_Controller_Front::getInstance()->getRouter();    

    /* Edit Groups */
    $route = new Zend_Controller_Router_Route('groups/edit/:group_id',array('controller' => 'groups','action' => 'edit')); 
    $router->addRoute('group_edit', $route);

    return $router;
}

Then in my view file I use this to echo the URL:

<a href="<?=$this->url(array('group_id' => $group->getId()), 'group_edit');?>" class=""><?=$group->getName()?></a>

And the url is echoing the way I want:

<a href="/fuhrmann/newsletter/groups/edit/1" class="">Group 1</a>

This is my application.ini:

    [production]

appnamespace = "Application"

; Debug output
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
resources.frontController.params.displayExceptions = 0

;PHP Setings
phpsettings.date.timezone = "America/Sao_Paulo"

; Include path
includePaths.models = APPLICATION_PATH "/models"
includePaths.application = APPLICATION_PATH
includePaths.library = APPLICATION_PATH "/../library"

; Bootstrap
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"


; Front Controller
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.env = APPLICATION_ENV
resources.frontController.actionHelperPaths.Action_Helper = APPLICATION_PATH "/views/helpers"
resources.frontController.moduleControllerDirectoryName = "actions"
;resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.defaultControllerName = "index"
resources.frontController.defaultAction = "index"
resources.frontController.defaultModule = "default"
;resources.frontController.baseUrl = "/newsletter"
;resources.frontController.returnresponse = 1

; Layout
resources.layout.layout = "layout"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"


; Views
resources.view.helperPath = APPLICATION_PATH "/views/helpers"
resources.view.encoding = "UTF-8"
resources.view.basePath = APPLICATION_PATH "/views"
resources.view.scriptPath.Default  = APPLICATION_PATH "/views/scripts"
resources.view.doctype = "HTML5"
resources.view.contentType = "text/html;charset=utf-8"
resources.view.helperPathPrefix = "Views_Helpers_"
resources.view.filterPathPrefix = "Views_Filters_"

resources.db.adapter = "PDO_SQLITE"


[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1


[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
resources.frontController.throwExceptions = true

resources.db.adapter = "PDO_MYSQL"
resources.db.params.host = "localhost"
resources.db.params.dbname = "newsletter"
resources.db.params.username = "root"
resources.db.params.password = ""
resources.db.isDefaultTableAdapter = true
resources.db.params.charset = utf8

My complete Boostrap file:

<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected function _initDoctype()
    {
        $this->bootstrap('view');
        $view = $this->getResource('view');
        $view->doctype('XHTML1_STRICT');
    }

    /**
     * Init Autoloader
     */
    protected function _initAutoload()
    {
        $loader = Zend_Loader_Autoloader::getInstance();
        $loader->setFallbackAutoloader(true);
    }

    /**
     * Adiciona alguns routers
     */
    protected function _initRoutes()
    {

        $router = Zend_Controller_Front::getInstance()->getRouter();


        /* Edit Groups*/
        $route = new Zend_Controller_Router_Route('/groups/edit/:groupId',array('controller' => 'group','action' => 'edit')); 
        $router->addRoute('group_edit', $route);


        return $router;
    }

}

My index.php (inside public) file:

<?php
// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    get_include_path(),
)));

/** Zend_Application */
require_once 'Zend/Application.php';

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
            ->run();

The problem is, when I click to open this page (the edit group page) I get this error:

Fatal error: Uncaught exception 'Zend_Controller_Router_Exception' with message 'group_id is not specified' in C:\xampp\htdocs\fuhrmann\newsletter\library\Zend\Controller\Router\Route.php:354 Stack trace: #0 C:\xampp\htdocs\fuhrmann\newsletter\library\Zend\Controller\Router\Rewrite.php(470): Zend_Controller_Router_Route->assemble(Array, true, true) #1 C:\xampp\htdocs\fuhrmann\newsletter\library\Zend\View\Helper\Url.php(49): Zend_Controller_Router_Rewrite->assemble(Array, NULL, true, true) #2 [internal function]: Zend_View_Helper_Url->url(Array, NULL, true) #3 C:\xampp\htdocs\fuhrmann\newsletter\library\Zend\View\Abstract.php(350): call_user_func_array(Array, Array) #4 C:\xampp\htdocs\fuhrmann\newsletter\application\layouts\scripts\layout.phtml(22): Zend_View_Abstract->__call('url', Array) #5 C:\xampp\htdocs\fuhrmann\newsletter\application\layouts\scripts\layout.phtml(22): Zend_View->url(Array, NULL, true) #6 C:\xampp\htdocs\fuhrmann\newsletter\library\Zend\View.php(108): include('C:\xampp\htdocs...') #7 C:\xampp\htdocs\fu in C:\xampp\htdocs\fuhrmann\newsletter\library\Zend\Controller\Plugin\Broker.php on line 336

Inside my EDIT action I can do a var_dump in all request params to see if the groupId is set, and yes, it is!

array(3) { ["groupId"]=> string(3) "555" ["controller"]=> string(6) "groups" ["action"]=> string(6) "edit" }

I already have searched for a lot of answers here and by the way, I found a question with an answer but no solution for me.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:20:44+00:00Added an answer on June 13, 2026 at 5:20 pm

    Ok, solved!

    What I did was to add a default value (NULL) to the group_id, so in my Bootstrap file I have this now:

    $route = new Zend_Controller_Router_Route('/groups/edit/:group_id',array('controller' => 'groups','action' => 'edit', 'group_id' => NULL));
    

    Thanks @philien!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't have much knowledge about the IPv6 protocol, so sorry if the question
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
We're building an app, our first using Rails 3, and we're having to build
This could be a duplicate question, but I have no idea what search terms
I have thousands of HTML files to process using Groovy/Java and I need to
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.