[RFC] script.php

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.
igorw
Registered User
Posts: 500
Joined: Thu Jan 04, 2007 11:47 pm

Re: [RFC] script.php

Post by igorw »

Yes, it should be styles/<style>/javascript.

User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Berlin, Germany
Contact:

Re: [RFC] script.php

Post by naderman »

Not sure if I agree that it should be outside of the template. Templates and themes are two separate parts. This would suggest that javascript is entire entity of its own. It'll typically purely depend on the generated DOM, meaning the templates. So I think that template-specific js should continue to live in the template folder (albeit its own javascript directory within it).

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: [RFC] script.php

Post by callumacrae »

Started work on this (script.php) because I think it would be very useful for 3.1. Does anyone know of any good JavaScript minification libraries for PHP? All the good ones I have found so far have either been Java or APIs.
Made by developers, for developers!
My blog

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC] script.php

Post by Oleg »

script.php is not useful without some scripts to put into it. In development it is actually not wanted as combining javascript files ruins file names/line numbers you get in browsers' error consoles. Lastly, if we do end up having a script.php it would almost certainly need to incorporate a way to include scripts from modifications, thus I would suggest holding off on implementing it until extensions are merged.

The pull request for script.php should be separate from any ajax pull requests, and I would say that the ajax stuff should be implemented first as right now we're doing just fine without a script.php.

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: [RFC] script.php

Post by callumacrae »

Oleg wrote:script.php is not useful without some scripts to put into it.
True, but I'm doing it because script.js was starting to get big, and I've hit a few limitations.
Oleg wrote:In development it is actually not wanted as combining javascript files ruins file names/line numbers you get in browsers' error consoles.
I know, I'm checking for PHPBB_DEBUG.
Oleg wrote:Lastly, if we do end up having a script.php it would almost certainly need to incorporate a way to include scripts from modifications, thus I would suggest holding off on implementing it until extensions are merged.
I know.
Oleg wrote:The pull request for script.php should be separate from any ajax pull requests, and I would say that the ajax stuff should be implemented first as right now we're doing just fine without a script.php.
It depends how script.php is implemented. Personally, I feel that script.php is essential, as without it it's going to be difficult to install multiple modifications as they will either reference the script.js include or the last line of script.js, which will result in conflicts. At the moment there still isn't a way to access language variables in the JavaScript, and I feel that there should be a way.

I can't see the point in merging the Ajax stuff, only to move it into script.php when that is merged. script.php will also probably be done first.
Made by developers, for developers!
My blog

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC] script.php

Post by Oleg »

callumacrae wrote: Personally, I feel that script.php is essential, as without it it's going to be difficult to install multiple modifications as they will either reference the script.js include or the last line of script.js, which will result in conflicts.
script.php is not needed for ajax. Wherever you were going to include script.php you can include all js files you have so far. Having 5 or even 10 straightforward javascript includes in a row is trivial; writing a comprehensive asset management system is not.

While we are probably going to need something like script.php for modifications, possibly, as far as core phpbb is concerned script.php is not essential to implementing ajax. As I said on irc the size of the ajax diff should be decreased so that it can be reviewed, adding asset management is not going to help move toward that goal.
callumacrae wrote: True, but I'm doing it because script.js was starting to get big, and I've hit a few limitations.
You should describe these limitations if they are really preventing ajax from working without script.php, as I can't think of any at the moment.
callumacrae wrote: I can't see the point in merging the Ajax stuff, only to move it into script.php when that is merged.
Nothing will be moved to script.php. The purpose of script.php is to merge existing javascript files. It has no content of its own.

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: [RFC] script.php

Post by callumacrae »

Oleg wrote:
callumacrae wrote: Personally, I feel that script.php is essential, as without it it's going to be difficult to install multiple modifications as they will either reference the script.js include or the last line of script.js, which will result in conflicts.
script.php is not needed for ajax. Wherever you were going to include script.php you can include all js files you have so far. Having 5 or even 10 straightforward javascript includes in a row is trivial; writing a comprehensive asset management system is not.
Of course it isn't needed, but having 5 JavaScript includes in a row is messy and increases HTTP requests.
Oleg wrote:While we are probably going to need something like script.php for modifications, possibly, as far as core phpbb is concerned script.php is not essential to implementing ajax. As I said on irc the size of the ajax diff should be decreased so that it can be reviewed, adding asset management is not going to help move toward that goal.
It isn't really needed for AJAX (although it would certainly make it easier for language, if that was parsed), I'm thinking about modifications here.
Oleg wrote:
callumacrae wrote: True, but I'm doing it because script.js was starting to get big, and I've hit a few limitations.
You should describe these limitations if they are really preventing ajax from working without script.php, as I can't think of any at the moment.
I think it's just language stuff at the moment. Igor suggested using data attributes on the required elements, but that is pretty hacky and wouldn't work for everything (for example, a JavaScript game that uses an extension)

Oleg wrote:
callumacrae wrote: I can't see the point in merging the Ajax stuff, only to move it into script.php when that is merged.
Nothing will be moved to script.php. The purpose of script.php is to merge existing javascript files. It has no content of its own.
...again, you know what I meant. I was talking from the perspective of the front-end (what with me doing front-end development).
Made by developers, for developers!
My blog

sajaki
Registered User
Posts: 86
Joined: Mon Jun 21, 2010 8:28 pm

Re: [RFC] script.php

Post by sajaki »

callumacrae wrote:What else will go in the assets directory? By the definition of assets according to the coding guidelines, the only other things that could go in there are images and css, both of which are somewhere else, and something like flash which I don't think any style authors use anyway. There is no point in a directory which will only ever have on thing in it.
I beg to differ : http://www.phpbb.com/community/viewtopi ... &t=2108168.

User avatar
MattF
Extension Customisations
Extension Customisations
Posts: 675
Joined: Mon Mar 08, 2010 9:18 am

Re: [RFC] script.php

Post by MattF »

Why would we want a script.php when we finally just got rid of style.php!?

style.php has been related to issues with caching css files that led to flashes of blank/white between page loads in webkit browsers.

won't a script.php do the same?

see: style.php not cached (although other css and js files are), and takes longer than anything to download!
Screen Shot 2011-09-23 at 1.03.14 PM.png
(74.27 KiB) Downloaded 1758 times
Because php files are usually not cached by the server, a script.php file could delay the delivery of JS files, as style.php does as shown above, which is visually noticed in webkit browsers :(
Has an irascible disposition.

User avatar
bantu
3.0 Release Manager
3.0 Release Manager
Posts: 557
Joined: Thu Sep 07, 2006 11:22 am
Location: Karlsruhe, Germany
Contact:

Re: [RFC] script.php

Post by bantu »

VSE+ wrote:Why would we want a script.php when we finally just got rid of style.php!?
+1

There has to a better approach.

Post Reply