[RFC] AJAX via jQuery / jQuery UI

Note: We are moving the topics of this forum and it will be deleted at some point

Publish your own request for comments/change or patches for the next version of phpBB. Discuss the contributions and proposals of others. Upcoming releases are 3.2/Rhea and 3.3.
GameCharmer
Registered User
Posts: 11
Joined: Tue Feb 16, 2010 7:03 pm

[RFC] AJAX via jQuery / jQuery UI

Post by GameCharmer »

I would love to see something done with AJAX in phpBB4. Something as small as loading the next page of posts in line as you scroll down the page in a thread would increase the overall look, feel, and load speed of most phpBB sites. I have done a considerable amount of work trying to get this to work in my install, but have failed when it comes to SEO and proper linking to threads/posts/etc. The entire goal of using jQuery/jQuery UI is the speed and flexibility of the jQuery libraries and the simple addition of said libraries to phpBB4. By linking to the Google hosted libraries, bandwidth is taken off of the local website. Since the Google hosted jQuery libraries are used on numerous websites, the current version of jQuery will probably be cached on user's browsers anyway, which will definitely help improve initial loading speed.

Simple visual effects, such as tabs, DIV pop-ups, forms fading in and out, stuff sliding around, are all easily handled by jQuery UI. The theme roller for jQuery UI will allow developers to crank out sleek looking UI themes to match current themes with minimal effort, improving the overall speed that mods/themes can be produced.

Rotsblok
Registered User
Posts: 325
Joined: Mon Nov 14, 2005 12:21 pm
Location: x= y+1

Re: [RFC] AJAX via jQuery / jQuery UI

Post by Rotsblok »

what makes you think that phpBB4 will not have it in the future (it's in the future cos phpBB4 is still centuries away :D )

as there are several topics in the 3.2 and 3.1 line about AJAX.. So my guess would be it shall have AJAX or a newer thing like it..
ø = 1.618033988749895...
Everything has ø in it

GameCharmer
Registered User
Posts: 11
Joined: Tue Feb 16, 2010 7:03 pm

Re: [RFC] AJAX via jQuery / jQuery UI

Post by GameCharmer »

A 3.1/3.2 upgrade to full blown AJAX is probably something that isn't going to happen. It would require a massive overhaul to the inner workings of how the board handles links to it's internal files being passed in via URL. Sure, adding nifty things to phpBB 3.1/3.2 would be awesome, but a complete AJAX website is best built from the start instead of scabbed in later on. Speaking from a bit of experience in converting a stock PHP framework to a PHP/AJAX framework, it's a complete nightmare handling all of the various URLS. I would up scrapping the majority of the source code and starting over for better AJAX implementation.

/a3
Registered User
Posts: 97
Joined: Mon Sep 20, 2010 6:44 am

Re: [RFC] AJAX via jQuery / jQuery UI

Post by /a3 »

A lot of visits to forums are from search engines and links on other websites. This would mean that everytime a link is visited the entire AJAX framework would have to be loaded.

Maybe it's just me, but that seems unreasonable.

I don't think AJAX is a bad thing, but it should only be used sparingly.

As for jQuery, there's already talk about it being included in phpBB 3.2, just FYI. :)
$ git commit -m "YOLO"

GameCharmer
Registered User
Posts: 11
Joined: Tue Feb 16, 2010 7:03 pm

Re: [RFC] AJAX via jQuery / jQuery UI

Post by GameCharmer »

phpBB3 already has a decent sized list of bots integrated into it's system. Should this system carry over, just use <!-- IF NOT IS_BOT --> Load AJAX <!-- ENDIF --> and your problem is solved. You could always add in user agent checking to eliminate JS loading as well.

Also, as I originally posted, you could use the Google libraries, so you don't expend the bandwidth, and the files will probably already be cached by the user's browser anyway, which will save on their end.
Link to some Info

As far as just including jQuery into phpBB 3.2, I was hoping to take that one step further and use it for an entire framework. As of right now, I have jQuery and jQuery UI bot included in one of my websites and I am using it for a wide assortment of things. From tabbed profiles, tabbed stats, accordion style menus, and the awesome modal div, the JS libraries are working out great! :)

igorw
Registered User
Posts: 500
Joined: Thu Jan 04, 2007 11:47 pm

Re: [RFC] AJAX via jQuery / jQuery UI

Post by igorw »

There are also a number of good reasons not to host jQuery with google which you can find in the topic /a3 linked to. And the plan for 3.2 is to port phpBB to use jQuery, not just include it for others.

GameCharmer
Registered User
Posts: 11
Joined: Tue Feb 16, 2010 7:03 pm

Re: [RFC] AJAX via jQuery / jQuery UI

Post by GameCharmer »

Agreed. The user should be allowed to select a jQuery source from the Board Setting page in the ACP though. Give the user the option to choose "Local File", Google, Microsoft, Custom, Etc.

I have never had service interruption with using Google's jQuery libraries, but just in case I use an if not function exists statement. If I'm missing a key jQuery function, it loads the local jQuery file. Granted, this is one check that could be eliminated by using a local copy straight away.

I was only saying that we should try and use it as a major part of the framework instead of just including it. Since phpBB3.2 is going to be ported to use jQuery, I think everything will go fine. I'm posting this in 4.0 in hopes of seeing is used from the beginning. I used a modded copy of the phpBB3.0.7-pl1 template engine to build a jQuery MMO, and it was one hell of a nightmare to get running initially. I did manage to streamline everything and still maintain the usage of the template engine, although it's probably not the most efficient setup.

Anyway, thanks for clearing everything up. :)

User avatar
Kudlaty
Registered User
Posts: 4
Joined: Fri Oct 22, 2010 7:31 am

Re: [RFC] AJAX via jQuery / jQuery UI

Post by Kudlaty »

i think that MooTools will be better choice then jQuery...
In MooTools we select what we need in application, in jQuery we must take whole script...

GameCharmer
Registered User
Posts: 11
Joined: Tue Feb 16, 2010 7:03 pm

Re: [RFC] AJAX via jQuery / jQuery UI

Post by GameCharmer »

I'm not quite sure I follow you bud. I have a lot of one-liner scripts for jQuery that work extremely well. $("ID").load("URL"), for example, is used in one of my BBCodes to load some output from a different PHP script on the server in order to display specific lists. This code looks like...

Code: Select all

[badges={URL}]{IDENTIFIER}[/badges]

Code: Select all

<div id="badges_{IDENTIFIER}"></div>
<script type="text/javascript">
$("badges_{IDENTIFIER}").load("badges.php?cmd={URL}");
</script>
Working Example

After briefly perusing the MooTools website, I feel a bit disappointed. I really don't get what they have going on over there. Reading over your post again, I think I finally got it. You are saying that with jQuery, you have to load the entire jQuery script. Looking at the download for MooTools, it would seem that you load an even larger single script than with jQuery. Considering that I am expecting us to want something fast, light weight, and something that doesn't create excessive page load times, jQuery just seems to be the best option. There are thousands of plugins for jQuery as well that bring an insane amount of JS functionality to the table. I use 5 dfferent plugins, plus jQuery UI in one of my online applications and have yet to notice any lag. The main page loads up, loading my JS libraries, and stays loaded, meaning I never pull those files again. Should the user navigate away and come back or should the user hit refresh, the .JS files should be cached in the browser's cache, keeping the load down. :)

User avatar
Kudlaty
Registered User
Posts: 4
Joined: Fri Oct 22, 2010 7:31 am

Re: [RFC] AJAX via jQuery / jQuery UI

Post by Kudlaty »

i mean that jQuery is slower then MooTools...
in MooTools U can pull only core + selectors or core + selectors + smth.
with jQuery U pull core + selectors + everything else... (U don't have choice what U want to download, so U load everything)

also try to search in google opinion about jQuery selectors and MooTools...

Post Reply