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 5929399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:25:00+00:00 2026-05-22T14:25:00+00:00

In my layout-script I wish to create a link, appending [?|&]lang=en to the current

  • 0

In my layout-script I wish to create a link, appending [?|&]lang=en to the current url, using the url view helper. So, I want this to happen:

http://localhost/user/edit/1 => http://localhost/user/edit/1?lang=en
http://localhost/index?page=2 => http://localhost/index?page=2&lang=en

I have tried the solution suggested Zend Framework: Append query strings to current page url, accessing the router directly, but that does work.

My layout-script contains:

<a href="<?=$this->escape( $this->url( array('lang'=>'en')) )?>">English</a>

If the default route is used, it will append /lang/en, but when another route is used, nothing is appended at all.
So, is there any way to do this with in Zend without me having to parse the url?

Edit
Sorry for my faulty explanation. No, I haven’t made a custom router. I have just added other routes. My bad. One route that doesn’t work is:

$Routes = array(
    'user' => array(
        'route' => 'admin/user/:mode/:id',
        'defaults' => array('controller' => 'admin', 'action' => 'user', 'mode'=>'', 'id' => 0)
    )
);

foreach( $Routes as $k=>$v ) {
    $route = new Zend_Controller_Router_Route($v['route'], $v['defaults']);
    $router->addRoute($k, $route);
}
  • 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-05-22T14:25:00+00:00Added an answer on May 22, 2026 at 2:25 pm

    Upd:

    You must add wildcard to your route or define ‘lang’ parameter explicitly.

    'admin/user/:mode/:id/*'
    

    Additionally, according to your comment, you can do something like this:

    class controllerplugin extends Zend_Controller_Plugin_Abstract
    {
        function routeShutdown($request)
        {
            if($request->getParam('lang', false) {
                //store lang
                Zend_Controller_Front::getInstance()->getRouter()->setGlobalParam('lang', NULL); //check if this will remove lang from wildcard parameters, have no working zf installation here to check.
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using this script to switch layouts in a page: $(span.switcher).click(function () { $(span.switcher).toggleClass(swap);
I want to add programatically 4 children to dijit.layout.AccordionContainer . The script runs with
I want to use a view script to render my zend form as it
If I define a layout using XML, but I want to populate it with
If I create a layout in CF9 using cflayout as below: <cfajaximport tags=cfform> <cflayout
I've tried using a Dojo button view helper, but it appears that Zend will
I'm upgrading a script to a new version with a hole new database layout.
<head runat=server> <title><asp:ContentPlaceHolder ID=TitleContent runat=server /></title> <link href=../../Content/css/layout.css rel=stylesheet type=text/css /> <script type=text/javascript src=/Areas/CMS/Content/js/jquery-1.3.2.min.js></script>
I'm having a Firefox-specific issue with a script I wrote to create 3d layouts.
the directory structure I'm trying to achieve would be this: application/default/views/layouts/layout.phtml application/default/views/scripts/index/index.phtml application/admin/views/layouts/layout.phtml application/admin/views/scripts/index/index.phtml

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.