We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40553
    • 42 Posts
    Im using Gallery plugin with getPage together which outputs the following url when switching between pages:


    • sitename.com?limit=5&page=2
    This works fine, yet I have another functionality I would like to add to the gallery which allows to search its images. It works the way that the search parameter is added to the url and looks like this:


    • sitename.com?keyword=word
    The thing is that I would want to keep all parameters in the url at all times while it keeps replacing ones from getPage with the ones from my search snippet and the other way around.
    What I would like to achieve is:


    • sitename.com?limit=5&page=2?keyword=word

    So far I have tried $modx->makeUrl but ot doesnt seem to recognize whenever "?" already exists so the "&" needs to be added. I was also trying to get the current url and append the variable to its end but using the following method I cannot get the parameters in the url:


    • $modx->makeUrl($modx->documentIdentifier, '', '', 'full');

    What Is the correct way to handle multiple variables being passed and reduced from the url?
      • 22303 MODX Staff
      • 10,725 Posts
      Something like this?

      $modx->makeUrl($modx->resource->get('id'), '', implode('&', $modx->request->getParameters(), 'full');


      You don't ever need to include the question mark.
        • 40553
        • 42 Posts
        great, works flawlessly. Thank you!