Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated

[SOLUTION] How to load custom JavaScript only on JomSocial pages?

6 years 6 months ago
  • Vladimir's Avatar
    Topic Author
  • Vladimir
  • Offline
  • Junior Boarder
  • Posts: 283
  • Thank you received: 40
Licenses:
JomSocial Active

Sometimes there is need to load additional JavaScript with theme. How to achieve that so every time JomSocial pages are displayed this script is loaded via template?

6 years 6 months ago
Licenses:

HI, Vladimir.

Thank you for contacting us.
Just add it into your Joomla! template. Why to load int a particular JS layout?
You may always wrap script load in php condition to display it on certain vie or Itemid:
docs.joomla.org/Retrieving_request_data_using_JInput
Then option=com_community.


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
The following user(s) said Thank You: Vladimir
6 years 6 months ago
  • Vladimir's Avatar
    Topic Author
  • Vladimir
  • Offline
  • Junior Boarder
  • Posts: 283
  • Thank you received: 40
Licenses:
JomSocial Active

Solved "problem" with:

if (JFactory::getApplication()->input->get('option')=='com_community')
{//Your assets that need to be loaded on JomSocial pages}
Put that in <head></head> section of index.php of active Joomla template and you are good to go.

Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW