I wrote a PHP script to deploy data to live-cdn and included a "deploy" button on the dashboard. the script returns ?success=true, and i need to show div element with "Congratulations"

i tried this with no success:

{% if app.request.query.get('success') %}
    Glückwunsch! Deployment läuft.
{% endif %}

3 Answers 3



{% if craft.request.getQueryString('success') %}



Actually, reading from the Craft 2 docs it's:

craft.request.getQueryString()      // returns the whole query string
craft.request.getQuery('success')   // returns only the value of 'success'
  • 6
    Thank you, Antoine, that was helpful. And in Craft 3 it seems to now be craft.app.request.getQueryParam() otherwise a deprecation error.
    – kr37
    Jan 20, 2019 at 6:12
  • 5
    @kr37 Cool! I suggest you turn your comment into a standalone answer, that would be helpful for Craft 3 users. I updated my answer to indicate that it applies to Craft 2.
    – antoine
    Jan 22, 2019 at 2:19

As @kr37 pointed out in the comments to another answer, the method for Craft 3, and now 4, is craft.app.request.getQueryParam()

{# get $_GET['foo'], if it exists #}
{% set foo = craft.app.request.getQueryParam('foo') %}

{# get $_GET['foo']['bar'], if it exists #}
{% set bar = craft.app.request.getQueryParam('foo.bar') %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.