Quote from: zerogravity at May 30, 2008, 10:04 AM
Yes I used external scripts, and I think I never instantiated DocumentParser (i don’t know how to do it too in this case).
You can do so very easily:
<?php
define('MODX_API_MODE', true);
include('/path/to/index.php');
// now use $modx freely, though in it's current state
// there are some limitations to this method.
?>
Quote from: zerogravity at May 30, 2008, 10:04 AM
i’ll try your suggestion.
does that mean on the javascript, i’ll refer to the modx page as:
index.php?id=1
1 here as an example refering to the ajax page, and then trail this with whatever parameter?
That really depends on what kind of Ajax request/response you are performing, but you should be able to use MODx tags to build the links directly in the Ajax document’s content in most cases, e.g. [~1~] or [~[*id*]~] for the current page, except where that is needed in external JS. In those cases, I try to pass such variables as JSON configuration objects into the external JS objects (typically by passing the configuration object through function parameters) from the document.
Hope that helps a little.