[RFC|Merged] Template tag to include JS files

These requests for comments/change have lead to an implemented feature that has been successfully merged into the 3.1/Ascraeus branch. Everything listed in this forum will be available in phpBB 3.1.
User avatar
Arty
Registered User
Posts: 970
Joined: Wed Mar 06, 2002 2:36 pm
Location: Mars
Contact:

Re: [RFC] Template tag to include JS files

Post by Arty » Mon Feb 27, 2012 9:29 pm

callumacrae wrote:EDIT: Ignore that, you're using INCLDEJS. Why are you using INCLUDEJS? XD
To enable template inheritance for it. Until RFC for T_STYLE_PATH (inheritance for all components) will be implemented, INCLUDEJS is the only way to allow inheritance for javascript files.
Formerly known as CyberAlien.

Free phpBB styles | Premium responsive XenForo styles

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

Re: [RFC] Template tag to include JS files

Post by callumacrae » Mon Feb 27, 2012 9:36 pm

Aha, I see. Fair enough.
Made by developers, for developers!
My blog

User avatar
Dragosvr92
Registered User
Posts: 624
Joined: Tue May 31, 2011 12:08 pm
Location: Romania
Contact:

Re: [RFC] Template tag to include JS files

Post by Dragosvr92 » Wed Feb 29, 2012 9:38 am

Will phpbb variables be parsed if in javascript files?

Like, will {T_STYLE_PATH} be parsed in a js file same as it gets parsed into a html file?
I needed to do this on the Lightbox MOD and it didnt work.
Previous user: TheKiller
Avatar on Memberlist 1.0.3

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

Re: [RFC] Template tag to include JS files

Post by callumacrae » Wed Feb 29, 2012 9:46 am

TheKiller wrote:Will phpbb variables be parsed if in javascript files?

Like, will {T_STYLE_PATH} be parsed in a js file same as it gets parsed into a html file?
I needed to do this on the Lightbox MOD and it didnt work.
No.
Made by developers, for developers!
My blog

User avatar
Arty
Registered User
Posts: 970
Joined: Wed Mar 06, 2002 2:36 pm
Location: Mars
Contact:

Re: [RFC] Template tag to include JS files

Post by Arty » Sat Mar 03, 2012 9:55 pm

Wiki article that includes this change: http://wiki.phpbb.com/New_Template_Commands_in_3.1
Formerly known as CyberAlien.

Free phpBB styles | Premium responsive XenForo styles

User avatar
brunoais
Registered User
Posts: 958
Joined: Fri Dec 18, 2009 3:55 pm

Re: [RFC] Template tag to include JS files

Post by brunoais » Sun Mar 04, 2012 8:42 am

Arty wrote:Wiki article that includes this change: http://wiki.phpbb.com/New_Template_Commands_in_3.1
Please confirm:
Does it keep the order of the INCLUDEJS tags? If it does that's something important to specify in the wiki.

An example would also be nice. Because I still don't know >90% how it works, it's better for you to write that example.
Anyway:
Great feature, dude!

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

Re: [RFC] Template tag to include JS files

Post by callumacrae » Sun Mar 04, 2012 8:48 am

brunoais wrote:
Arty wrote:Wiki article that includes this change: http://wiki.phpbb.com/New_Template_Commands_in_3.1
Please confirm:
Does it keep the order of the INCLUDEJS tags? If it does that's something important to specify in the wiki.

An example would also be nice. Because I still don't know >90% how it works, it's better for you to write that example.
Anyway:
Great feature, dude!
Yes, it will keep the order.

What don't you get about the example on the wiki article? You call the INCLUDEJS function, it inserts the script after the jQuery tag…
Made by developers, for developers!
My blog

User avatar
Arty
Registered User
Posts: 970
Joined: Wed Mar 06, 2002 2:36 pm
Location: Mars
Contact:

Re: [RFC] Template tag to include JS files

Post by Arty » Sun Mar 04, 2012 9:22 am

I've added example to wiki to make things clearer.
Formerly known as CyberAlien.

Free phpBB styles | Premium responsive XenForo styles

User avatar
brunoais
Registered User
Posts: 958
Joined: Fri Dec 18, 2009 3:55 pm

Re: [RFC] Template tag to include JS files

Post by brunoais » Mon Mar 05, 2012 7:00 am

Your changes do not answer my question.
You state that all script tags are placed after jQuery's script tag. That's ok and was already there.
Another thing you do not tell in the wiki:
Do tag order maintains?
In the code:

Code: Select all

<!-- overall_header.html -->
	header stuff here
<!-- end of overall_header.html -->
<!-- custom template -->
	<!-- INCLUDEJS template/custom1.js -->
	Some content
	<!-- INCLUDEJS template/custom2.js -->
<!-- end of custom template -->
<!-- overall_footer.html -->
	<!-- INCLUDEJS template/custom3.js -->
	footer code here
	jQuery is included here
	</body>
</html>
<!-- end of overall_footer.html -->
Can it become?

Code: Select all

header stuff here
some content
footer code here
jQuery is included here
<script src="./styles/prosilver/template/custom3.js"></script>
<script src="./styles/prosilver/template/custom1.js"></script>
<script src="./styles/prosilver/template/custom2.js"></script>
</body>
</html>
Does the tag order in the files persist? You do not specify that anywhere in that wiki article.

User avatar
Arty
Registered User
Posts: 970
Joined: Wed Mar 06, 2002 2:36 pm
Location: Mars
Contact:

Re: [RFC] Template tag to include JS files

Post by Arty » Mon Mar 05, 2012 7:56 am

Yes, that's exactly what it will become
Formerly known as CyberAlien.

Free phpBB styles | Premium responsive XenForo styles

Post Reply