Xajax 0.5.3 in Code Igniter 1.5.4 |
[eluser]Leonardo Radoiu[/eluser]
Hello! For everyone out there who may need some help implementing Xajax 0.5.3 in the latest version of Code Igniter here is an example. First of all the xajax library file that will be loaded: Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); You need to place folder "xajax_core" from the Xajax 0.5.3 kit in the system/libraries folder of the Code Igniter framework. Now, let's say we have a list of items and we want to fill a select box with this list, dinamically, using Xajax. We create a model named Item with a method that selects the items using, let's assume again, a webservice: Code: <?php Please observe we don't register this function here. We'll do that later, below. The js code for function Item_SelectItems (you need to load this function in the head section of the view in the xajax.js file): Code: /* I use jquery.selectboxes.js plugin to fill the select box */ Now, we need a controller named mypage.php that registers the xajax function: Code: class MyPage extends Controller { Finally, the view named mypage.php that holds the form field and calls the js-fied xajax function. Code: <html> In the end I attach the code for the ItemWSVC web service: Code: class ItemWSVC extends Controller {
[eluser]Avatar[/eluser]
I get an error where I try to do this tutorial. Output has already been sent to the browser at /home2/user/public_html/system/libraries/xajax_lib.php:8. Please make sure the command $xajax->processRequest() is placed before this.
[eluser]Leonardo Radoiu[/eluser]
Hi there! Make sure that your included files don't have a white space outside the php code because that will make your header output before executing $xajax->processRequest(): Example: Code: verify that there is no white space in any included file right here -> <? php Moreover, even there is no white space at the start or the end of the files make sure that your editor is one in which you may set the file format to Unix file format (like Dreamweaver, Eclipse or Editplus) and not Notepad or Wordpad, applications that formats your file in PC format by default. If you edit your files with Notepad you will have to re-create them in an editor that knows about Unix file format.
[eluser]Leonardo Radoiu[/eluser]
Well... glad to know I was helpful. You seem to be interested in cool-things technology. I like that. I believe that one can do some pretty good stuff with Xajax and Nusoap if he knows how. Good luck!
[eluser]Avatar[/eluser]
Yes, this is very helpful. I was just starting to do webservices. I still quite don't understand exactly how the data is being passed around here. Not the webservice, but when xajax and jquery come into play. I've created a member model with some data and it still doesn't return my db values to fill the selectbox. Can you post an example on how I would use data from the websevice to fill a div or something with xajax and when the div gets click the data is refreshed? I hope this is not asking for too much. I've been using CI for roughly 1 year now and just recently joined this forum. The main thing that doesn't make sense in your example is how the params work. Thank you in advance, this is some neat stuff.
[eluser]Leonardo Radoiu[/eluser]
Hello! I did a full example from scratch in this new topic: http://ellislab.com/forums/viewthread/60879/ The scripts are fully functional, I just test them on my computer. There may be some limitations in the forum editor, I believe some data were truncated on post but if you have problems I made an archive in this location: http://leonardo.kreativ.ro/sources/ci/xa...nusoap.rar I also made a GIF schema on how you may use the model with/without XAJAX or with/without NUSOAP. I believe it's self-explanatory. http://leonardo.kreativ.ro/wp-content/up..._xajax.gif
[eluser]Avatar[/eluser]
NUSOAP/XAJAX is awesome technology, Thanks for posting your knowledge on it and how easy it is to integrate it into CI.
[eluser]djreed[/eluser]
Thanks for this! Can you clarify something for me? Where do you place this code. What does it do?: Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); Thanks! -Danny |
Welcome Guest, Not a member yet? Register Sign In |