[SOLVED]custom template loading additional js and css

More
9 years 7 months ago - 9 years 7 months ago #50215 by mdma
hello,
when creating custom template with additional js,css
whats the best practice?
Code:
JFactory::getDocument()->addScript( JURI::base().'components/com_flexicontent/assets/js/myjs.js');
or
Code:
JFactory::getDocument()->addScript( JURI::base().'components/com_flexicontent/templates/mytemplate/js/myjs.js

or adding in mytemplate.xml

what do you recommend?
Last edit: 9 years 7 months ago by mdma.

Please Log in or Create an account to join the conversation.

More
9 years 7 months ago #50221 by ggppdk
Hello

if it is code specific to the template then better add it:
/mytemplate/js/

if you share it among many templates, it is probably better to have it in some other folder

e.g. if you think that you will need to modify same JS in many templates, maybe it is best to be in a shared folder


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
9 years 7 months ago #50223 by mdma
thankyou! i understand.

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.507 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline