Page 1 of 1

xajax error

Posted: Sat Sep 08, 2007 11:02 pm
by aln_cms
Hi,
I'm trying to develop a module whose front end user interface uses xajax.  I've created code that works (if I move it from cmsms it's fine). I get an "xml entity declared outside ...." error when the xajax calls returns in my java script console.  The xml returned is valid.

I did some reading and some people found whitespace, but I cannot find a whitespace error in my templates or the code that ouputs the page headers.

Any help appreciated,
Alan

Re: xajax error

Posted: Sun Sep 09, 2007 11:23 am
by aln_cms
I did some digging last night and found out that the reason this is happeningis that the entire page seems to be getting sent rather than the xml request. I'm new to Ajax so my terminology may be off here.  To fix this in the admin section, so that Ajax works I added

Code: Select all

function SuppressAdminOutput($params){
return true;
}
This allows for ajax to work  in the admin section.  At the front end for my module (action.default.php), I could not figure out how to supress the content / buffer the data.  So I divided my default code in two: action.ajaxsetup.php & and action.default.php.

I have to place

Code: Select all

{cms_module module="euroCV" actiond="ajaxsetup"}

and later on i the template

Code: Select all

{cms_module module="euroCV"}
before the opening html tag in my template, this means that the Xajax object is created before the headers are created.  This is a dirty hack and I would like to know how to buffer the content so that I can have all my code in one module 'action'

CMSMS rocks!

Thanks,

Alan

Re: xajax error

Posted: Tue Sep 11, 2007 2:15 pm
by calguy1000
Look at the Uploads module action.getfile.php or in the FLVPlayer module.

to disable the admin theme output you can add a "showtemplate=false" parameter to the url.
to be sure that there is no output in the buffer before you send yours out, you can use ob_clear() like uploads does.

Re: xajax error

Posted: Tue Sep 11, 2007 3:03 pm
by aln_cms
hey there,


Thanks for that, I would have spent a long time digging.

Alan