We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9995
    • 1,613 Posts
    I have a multilanguage website which doesn’t load the correct homepage after the agecheck.
    The agecheck looks if there is a cookie, if yes then go to the homepage, if not go to the agecheck page.
    When the agecheck is correct the NL homepage is loaded nomatter which language I came from.
    I need it to redirect to the EN homepage after filling the EN agecheck..

    Agecheck id: 1
    Home id: 12
    Logincheck is: 13

    I use YAMS and default language is NL

    All pages has this script:

    <script>
    if(!$.cookie("date") && [*id*] != 1) {
    window.location="/[~1~]";
    }
    </script>


    After the form is filled I go to ID 13. This works correct. When starting on the EN page I go to the EN logincheck page.
    On that page there is a snippetcall:

    [!loginchecker? &redirectTo=`12`!]


    The snippet looks like:
    <?php
    if (isset($_COOKIE['date'])){
    // here some code…
    $url = $modx->makeUrl($redirectTo);
    if ($refUrl != '') {
    $url = $refUrl;
    }
    return $modx->sendRedirect($url);
    }
    $url = $modx->makeUrl(1);
    return $modx->sendRedirect($url);
    ?>


    I have looked for solutions but I don´t understand it that great.
    Didn´t made the agecheck.

    All I found are these posts but I don't know how to fix it.
    http://stackoverflow.com/questions/21934144/equivalent-to-modx-getdocument-in-yams
    https://rtfm.modx.com/extras/evo/yams/yams-english-documentation/yams-snippet

    Is there someone who knows what to do?
      Evolution user, I like the back-end speed and simplicity smiley
      • 9995
      • 1,613 Posts
      i have it solved by a meta redirect for the EN version.
        Evolution user, I like the back-end speed and simplicity smiley