We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6705
    • 79 Posts
    I need to create a page, well, I suppose it’s a non-page of sorts, which unsets a cookie, does a small amount of other PHP processing, and then redirects to a new URL via the Location: header. There will be no actual page output as such whatsoever.

    Is there an easy way to do this in MODx? The difficulty of course is that cookie-handling and header-setting both need to be done before there is any page output whatsoever.

    Alternatively, I suppose I could create the php script as an actual page in the filesystem: is there somewhere I should put such a page, and anything I would need to set up in MODx to prevent it from trying to process the URL as if it were a MODx "Friendly URL" belonging to an actual MODx page?

    Thanks for any advice.
      Please don't PM me unless it's absolutely essential: if a technical question is worth asking, it's worth asking in public, so that others can share their experience, and so that all can learn from the answers.
      • 36404
      • 307 Posts
      hi,

      well, the simplest way to do this is to create a page/ressource that you do not display in the menu and call a snippet in this page that will do the job

      i use that kind of page quite often (for ajax for example) and, to make it easier, i use minimal template as the page template, set the wysiwyg on no in the page and simply write my snippet call in the content textarea, done! smiley
      (minimal template is just a blank template with [*content*] then no html output or else before your cookie/session or header tricks)

      when it comes to the page url you can either use an alias if you’re using url_rewriting or simply [~n~] n being the page index

      Have swing
        réfléchir avant d'agir