Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

JoomlaTune Support Forum    JComments component    Suggestions, Wishlists & Feature Requests    Topic: JComments system plugin always loads CSS and scripts
Pages: [1]   Go Down
  Print  
Author Topic: JComments system plugin always loads CSS and scripts  (Read 2419 times)
0 Members and 1 Guest are viewing this topic.
Blogomunity
Newbie
*

Karma: 0
Offline Offline

Posts: 2


« on: February 24, 2010, 02:57:57 »

We don't use these stylesheets and scripts where jcomments is not used.

You need a setting which allow to select for which components to load these css and scripts, smth like:
instead of
Code:
}
else {
include_once (JCOMMENTS_BASE . DS . 'jcomments.class.php');
include_once (JCOMMENTS_BASE . DS . 'jcomments.config.php');
include_once (JCOMMENTS_HELPERS . DS . 'system.php');

Use:

Code:
}
else if (in_array($components, JRequest::getCmd('option')) {
include_once (JCOMMENTS_BASE . DS . 'jcomments.class.php');
include_once (JCOMMENTS_BASE . DS . 'jcomments.config.php');
include_once (JCOMMENTS_HELPERS . DS . 'system.php');

For now we use these scripts for com_content only:
Code:
else if (JRequest::getCmd('option') == 'com_content') {
include_once (JCOMMENTS_BASE . DS . 'jcomments.class.php');
include_once (JCOMMENTS_BASE . DS . 'jcomments.config.php');
include_once (JCOMMENTS_HELPERS . DS . 'system.php');



Besides onAfterRender() event enormously uses regular expressions, what is the purpose of removing scripts here?

I think this event should be completely removed.
Logged
smart
Administrator
Hero Member
*****

Karma: 146
Offline Offline

Gender: Male
Posts: 2579



WWW
« Reply #1 on: April 15, 2010, 14:34:53 »

This plugin removes all JComments scripts and styles if on current page JComments isn't used. You solution with component name is incomplete because if will include styles and scripts on all com_content pages even if some article doesn't contain comments and they disallowed here. There are only 2 regular expressions and they aren't very complex...

Current JComments version has bug and styles aren't removed but in new version this bug already fixed - you can see this on demo.joomlatune.com
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
Pages: [1]   Go Up
  Print  
JoomlaTune Support Forum    JComments component    Suggestions, Wishlists & Feature Requests    Topic: JComments system plugin always loads CSS and scripts
 
Jump to: