xajax error

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
User avatar
aln_cms
Forum Members
Forum Members
Posts: 88
Joined: Mon Jan 08, 2007 7:09 pm
Location: Ireland

xajax error

Post 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
--
Alan Ryan
Lead Developer
CodeCrunchers Internet Software Development - Ireland
http://www.codecrunchers.ie
User avatar
aln_cms
Forum Members
Forum Members
Posts: 88
Joined: Mon Jan 08, 2007 7:09 pm
Location: Ireland

Re: xajax error

Post 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
--
Alan Ryan
Lead Developer
CodeCrunchers Internet Software Development - Ireland
http://www.codecrunchers.ie
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: xajax error

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
aln_cms
Forum Members
Forum Members
Posts: 88
Joined: Mon Jan 08, 2007 7:09 pm
Location: Ireland

Re: xajax error

Post by aln_cms »

hey there,


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

Alan
--
Alan Ryan
Lead Developer
CodeCrunchers Internet Software Development - Ireland
http://www.codecrunchers.ie
Post Reply

Return to “Developers Discussion”