We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42841
    • 24 Posts
    So basically I have a little draw-by-draw competition app for Facebook, and I'd like to use the Publish dates (from/to) built into the default resource, and the client can simply edit the template variables etc per draw, and choose a start time / end time.

    How would I go about creating a default "fallback" page, that would have some sort of "There are no draws available at this time" message.
    Obviously enough, the fallback page would display if there were no other published resources.

    The URL is always the same, ex: http://mydomain.com/this-app/

    Thanks,

    Ahren.


      • 3749
      • 24,544 Posts
      I'm not completely clear on what you're doing, but if the pages are on a MODX Revolution site and the resources are children of the same folder (let's say the parent folder's ID is 12), this snippet could do it:

      $docs = $modx->getCollection('modResource', array('parent' => 12));
      if (empty($docs)) {
         $modx->sendRedirect('http://full/url/of/fallback/page');
      }
      return '';
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 42841
        • 24 Posts
        Hi BobRay,

        Thanks for the quick reply, and apologies I wasn't exactly clear but yes I think you're on the right track.

        I'll give it a go and let you know if it works.