zend-frameworkzend-view

how to build query string in zend framework?


I'm trying to build a query string as following:

<a href="<?= $this->url(array('page' => $this->next)) ?>" class="next">Next Page</a>

I want to add an array to query string. For example, array('find_loc'=>'New+York', 'find_name'=>'starbucks')

I expect to get url that looks like http://example.com/1/?find_loc=New+York&find_name=starbucks

What's the best way to do this? I found a similar question that suggested appending the string to the url. Is there a helper for query string?


Solution

  • Simple answer to your question is no.

    Here is the class description:

    /**
     * Helper for making easy links and getting urls that depend on the routes and router
     *
     * @package    Zend_View
     * @subpackage Helper
     * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
     * @license    http://framework.zend.com/license/new-bsd     New BSD License
     */
    

    Helper for making easy links and getting urls that depend on the routes and router

    I think the description is clear in it's purpose. Use it for making URLs that depend on the routes and router. So, just append your query strings as recommend in the link you posted in your question.