1
mrfritz
Ajax in Xoops Template
  • 2005/6/30 19:59

  • mrfritz

  • Just popping in

  • Posts: 3

  • Since: 2005/6/30


I'm trying to build a template using Javascript's XMLHTTPRequest object to pull module data without refreshing the entire page.

The code seems to work on most pages, but I'm having a problem with the new_bb/viewforum.php. Every time I click a button that calls data from that page, I am redirected to the actual page instead of the data appearing on the start page.

I am using the alert() function to display the data before it's incorporated into the page, but the forum data always shows up blank, then redirects.

The code works on the index page of the site, other modules and other pages of the forum module, but that one page is constantly redirecting and I can't figure out why.

Is there something in the viewforum.php file that causes a refresh or redirect when a request comes in?

Here's the portion of Javascript code that calls the data and attaches it to the current window:
this.load = function(string) {   
//string is the url to pull from

    
if (string.indexOf('?') != -1){
      
string += '&ajax=true';  
    } else {
      
string += '?ajax=true';
    }
    
self.http.open('get'string);
    
self.http.onreadystatechange handleData;
    
self.http.send(null);
    
self.pagelink string;
  }
  
  function 
handleData() {
    if (
self.http.readyState == 4) {
     
//self.element is the  element
      
self.element.innerHTML self.http.responseText;
    }
  }

2
mrfritz
Re: Ajax in Xoops Template
  • 2005/6/30 20:53

  • mrfritz

  • Just popping in

  • Posts: 3

  • Since: 2005/6/30


Additional:

I'm using a dropdown list for sorting on the viewforum page, and that seems to work fine. When I click an option, the data is resorted in the background and the new table is displayed on the same page.

Evidently the only time I have a problem is when choosing a forum from the newbb/index.php page. I can't figure out where the problem is as the code is exactly the same on both pages...

3
phppp
Re: Ajax in Xoops Template
  • 2005/7/1 3:38

  • phppp

  • XOOPS Contributor

  • Posts: 2857

  • Since: 2004/1/25


Very interesting work.

I have been thinking about Ajax for cbb.
Could you plz contact me MSN: php_pp AT hotmail dot COM

4
giba
Re: Ajax in Xoops Template
  • 2005/8/22 14:45

  • giba

  • Just can't stay away

  • Posts: 638

  • Since: 2003/4/26


Yes Ajax Revoluction form for apresentation front-end.

The tecnologie is very good.

Examples:

- Chat
- News
- Articles
- Downloads
- And more examples.

I very happy with this

Look for examples:

Thanks RedEye:


http://www.adaptivepath.com/publications/essays/archives/000385.php

http://www.phpbuilder.com/columns/kassemi20050606.php3

http://www.theopensourcery.com/wordp1/index.php?p=262

http://www.tutorialized.com/tutorial/AJAX-Asynchronous-Javascript-and-XML-Using-PHP-to-send-data/8574 --> tutorial



More one example

http://iakt.rdsnet.ro/demos/ajax/mxw3_masked_textfield.php

[Edited]
Thanks Claudia (XOOPS Brasil)

Example in Xoops

http://www.lojademo.com.br/xoops/testeajax-cep-xoops.php

Postal code for brasil, example: 07070100
[/edited]

5
romdg
Re: Ajax in Xoops Template
  • 2005/10/30 1:37

  • romdg

  • Just popping in

  • Posts: 10

  • Since: 2004/6/9 1


has anyone tried out SAJAX?

Looks interesting...

Will try out the template code and give my 2 cents..

Cheers,
~gt

6
alitan
Re: Ajax in Xoops Template
  • 2005/10/30 2:09

  • alitan

  • Quite a regular

  • Posts: 399

  • Since: 2004/3/14


VERY intresting! The implentation of such feature on CBB, Chat or Comment system, makes a big difference not only in websites'Bandwidth, but also in loading speed as well. Infact, this can be a revelutionary step both in developing XOOPS and developing other open Source CMSes also. I am really looking forward to this!
My Persian Xoops Project:
http://www.MPXP.org

7
smdcom
Re: Ajax in Xoops Template

This is VERY interesting topic. The biggest advantage of using Ajax technologies is that data can be manipulated without having to render the entire page again in the web browser. This allows web applications to respond more quickly to many types of user interaction and to avoid repeatedly sending unchanged information back and forth across the network.

8
EyeKeeper
Re: Ajax in Xoops Template
  • 2005/11/18 14:03

  • EyeKeeper

  • Quite a regular

  • Posts: 209

  • Since: 2002/6/11


mrfritz,

did you solve this problem? and is there a demo site do view this running?

9
kaotik
Re: Ajax in Xoops Template
  • 2005/11/18 16:25

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


you might also want to check out xajax.
From what I've read it's easier for working with $_POST
there is also a 3rd php library for ajax.... I just can't remember it's name.

10
Herko
Re: Ajax in Xoops Template
  • 2005/11/18 18:24

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


AJAX isn't a new technology, it's 'just' xhtml and javascript. Some usefull functions for presentation and navigation are bundled. It's a powerful combination, but definately not new. But it's hyped a LOT (too much IMHO). Real usability comes from knowing how someone uses your application I think, not from using technology But again, it's a very usefull and powerful package!

Herko

Login

Who's Online

361 user(s) are online (225 user(s) are browsing Support Forums)


Members: 0


Guests: 361


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits