We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17833
    • 28 Posts
    Can i run a snippet from an anchor tag?

    something along the lines of:
    $output .= "<a $modx->runsnippet[’ClockInOut’]>".$status."</a>";
    or
    $output ."<a href=index.php?id=".$modx->documentIdentifier." onclick= ".$modx->runSnippet[’ClockInOut’].">".$status."</a>";

    the above both don’t seem to work, the snippet runs when the page is refreshed, without having to click on the link sad
    • Garry Nutting Reply #2, 18 years ago
      Well, the answer in a nutshell is no - all snippets are parsed before the page is delivered to the browser. The easiest way would be to use a form and then process the $_POST variables to carry out the action.
        Garry Nutting
        Senior Developer
        MODX, LLC

        Email: [email protected]
        Twitter: @garryn
        Web: modx.com
        • 28373
        • 204 Posts
        Quote from: Machiavelli at May 19, 2006, 07:17 PM

        Can i run a snippet from an anchor tag?

        something along the lines of:
        $output .= "<a $modx->runsnippet[’ClockInOut’]>".$status."</a>";
        or
        $output ."<a href=index.php?id=".$modx->documentIdentifier." onclick= ".$modx->runSnippet[’ClockInOut’].">".$status."</a>";

        the above both don’t seem to work, the snippet runs when the page is refreshed, without having to click on the link sad

        If you run out of ideas perhaps try something like...

        Putting the snippet call in a seperate page and call the page from a link - the regional selectors at escortsnz.com are links referring to pages that contain the snippet and parameters for the php sorting escorts by region. You could use javascript to take you back to the referring page after the snippets been processed, something along those lines depending on what your trying to accomplish might work smiley