hi,
how can i set javascript in Frontend Template without '<% function %>'?
i want set it in class modelAdmin, the javascript should be on all sides.
regards, dh
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
hi,
how can i set javascript in Frontend Template without '<% function %>'?
i want set it in class modelAdmin, the javascript should be on all sides.
regards, dh
Hi Dh,
I'm not sure what you want here. Does this help?
You can use:
Requirements::javascript(THEMES_DIR.'/myproject/js/script.js');
In your DataObject's getCMSFields() function. That will automatically load the javascript when the ModelAdmin loads that DataObject's class.
- Julian
Requirements::javascript(THEMES_DIR.'/myproject/js/script.js');
make it in Backend, i need it in Frontend, in the view area (in the *.ss - <head></head> or best on body tag end)
this is for my module.