• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.3 Include JavaScript in template ?

LordsKing

Active member
#1
Hi :D
Is it possible to do a template named like this : xxxxxxxx.js ?
And if possible how ca I insert the template in an other template ?
Maybe : <xen:include js="xxxxxxxx.js" /> ?
 

Brogan

XenForo moderator
Staff member
#2
From the FAQ:

Where can additional JavaScript be placed?
Additional JavaScript can be placed in the PAGE_CONTAINER, page_container_js_head or page_container_js_body templates. If PAGE_CONTAINER is used, it can be placed anywhere in the template. If page_container_js_head is used, it will be included in the head section of PAGE_CONTAINER. If page_container_js_body is used, it will be included in the body section of PAGE_CONTAINER, after the footer. It depends on the JavaScript to a large extent; some require to be placed in the head, some in the body.

How do I include a JavaScript file?
Code:
<xen:require js="name_of_javascript_file.js" />
 

LordsKing

Active member
#3
From the FAQ:

Where can additional JavaScript be placed?
Additional JavaScript can be placed in the PAGE_CONTAINER, page_container_js_head or page_container_js_body templates. If PAGE_CONTAINER is used, it can be placed anywhere in the template. If page_container_js_head is used, it will be included in the head section of PAGE_CONTAINER. If page_container_js_body is used, it will be included in the body section of PAGE_CONTAINER, after the footer. It depends on the JavaScript to a large extent; some require to be placed in the head, some in the body.

How do I include a JavaScript file?
Code:
<xen:require js="name_of_javascript_file.js" />
Thanks you very much :D