Hi again with AJAX!
I’m creating an independant php file for each request handler... it works fine, but how can I use the DB api inside them? I can use it everywhere in my module, but the ajax request handlers are called in a separate thread wich is not logged in the manager and parsed by MODx...
So, the only way I could imagine would be to find a way of calling a snippet or something like that.... could you help me there?
thanks a lot in advance,
Blaise
Blaise Bernier
www.medialdesign.com - Solutions for small business, hosting, design and more!
-
☆ A M B ☆
- 24,524 Posts
You can’t. Unless you are willing to include the document.parser.class.inc.php file, in start a new modx class. And even then, you’ll have problems with the include paths that the parser uses internally for including the db api class. I found the best way is to include the config.inc.php file for the database info and use straight mysql_xxx php functions. The DBAPI makes several calls to modx class methods, so it cannot be used by itself.
ok... ill go with the config.inc.php!
Thanks!
Blaise Bernier
www.medialdesign.com - Solutions for small business, hosting, design and more!
-
☆ A M B ☆
- 24,524 Posts
If you really use a lot of sql in your scripts, you could use a dbapi library of your own; my favorite for years has been
ezsql; in fact I was a little disappointed the MODx team decided to roll their own rather than go with this one. WordPress uses it.
Quote from: grunt_lord at Mar 16, 2006, 12:05 AM
Hi again with AJAX!
I’m creating an independant php file for each request handler... it works fine, but how can I use the DB api inside them? I can use it everywhere in my module, but the ajax request handlers are called in a separate thread wich is not logged in the manager and parsed by MODx...
So, the only way I could imagine would be to find a way of calling a snippet or something like that.... could you help me there?
thanks a lot in advance,
Blaise
i have the solution for this ajax related problem!
i’ll post in a wiki today with examples and all, plase be patient, it’s a good solution i guess... worth the look
visit us at www.dospuntocero.cl
-
☆ A M B ☆
- 24,524 Posts
Ah, that was long ago. I was referring to the dbapi.mysql.class.inc.php file, and a library of simple data access functions.
Of course xpdo is a totally different matter of which I will freely admit I know nothing at all as yet.
ok as i promised, i post this page to the wiki, i hope this works for you and if the comunity can perfect it will be nice start to see lots of ajax stuff in our beloved MODx
http://wiki.modxcms.com/index.php/Use_AJAX_with_modxAPI
visit us at www.dospuntocero.cl
Looks cool. I will give it a go as soon as I get some time. Thanks for posting this in the wiki.