We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42358
    • 1 Posts
    Hi All,

    New to Modx.

    I'm trying to access session_id() and/or other session stuff , but I'm getting inconsistent results that I think are due to the snippet caching.

    But when I put a !before the snippet name [[!session_snippet]] the snippet does not seem to work at all.

    I have the snippet being called in a header chunk so that it is called before the <html> tag in the template.

    a) am I missing something with my attempt?

    b) is there a modx way of accessing session_id or session data?

    <?php
    // startCMSSession(); // is this not autocalled at start of each modx page?tried with and without.
    
    
    $_SESSION['buid'] = session_id();
    
    $buid = $_SESSION['buid'];
    
    echo ":" . $buid .":<br>";// if I put a ! in snippet call to uncache, this does not echo but without ! it echoes same on different computers.
    ?>
    


    thanks
      • 16278
      • 928 Posts
      The tag syntax for an uncached snippet is [!Snippet? !], not [[!Snippet]], which is the Revo way.
      :) KP