Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • kbrookes Friend
    #672735

    I’ve been having an odd issue with the Purity III template where turning on Optimisation in the template does exactly what you expect, concatenating and compressing all JS and CSS assets in the header, but for an unknown reason it’s failing to do so for chronoform assets.

    It’s weird, because a colleague is using a T3 powered site with chronoform and his site is definitely including those assets in the optimisation.

    It’s most visible on the home page at the moment, as it’s the only page where I’m loading a chronoform.

    Regards,

    Kelsey

    jooservices Friend
    #672839

    Hi there
    If you are using 3rd extensions that i would suggest do not optimize css / js like that way. You should manage it by manual.
    Or you can exclude 3rd assets .

    Thank you,
    Viet Vu

    jooservices Friend
    #746731

    Hi there
    If you are using 3rd extensions that i would suggest do not optimize css / js like that way. You should manage it by manual.
    Or you can exclude 3rd assets .

    Thank you,
    Viet Vu

    kbrookes Friend
    #672841

    Thanks, but I was hoping to understand why these assets are not being included while others are. It’s **only** assets from this one extension.

    And that particular extension seems to work fine with T3 on a colleague’s site, so I’m doubly confused.

    kbrookes Friend
    #746733

    Thanks, but I was hoping to understand why these assets are not being included while others are. It’s **only** assets from this one extension.

    And that particular extension seems to work fine with T3 on a colleague’s site, so I’m doubly confused.

    jooservices Friend
    #672842

    Hi there
    It’s understandable if your extension use alt way to add script into site, and T3 can’t catch it.

    And in fact i would not suggest use ANY automate optimize system except we really know and understood root cause of it. Or we’ll face lot of troubles.

    Thank you
    Viet Vu

    jooservices Friend
    #746734

    Hi there
    It’s understandable if your extension use alt way to add script into site, and T3 can’t catch it.

    And in fact i would not suggest use ANY automate optimize system except we really know and understood root cause of it. Or we’ll face lot of troubles.

    Thank you
    Viet Vu

    kbrookes Friend
    #672844

    That’s exactly what I’m trying to understand – why does T3 catch the scripts for this extensions on one site and not another? How can I figure out why?

    kbrookes Friend
    #746736

    That’s exactly what I’m trying to understand – why does T3 catch the scripts for this extensions on one site and not another? How can I figure out why?

    jooservices Friend
    #672845

    Hi there
    You can check into source code of T3 for that.
    In logic if 3rd extension use alt way ( like system plugin hijack ) than of course T3 can’t catch it. 🙂
    Thank you,
    Viet Vu

    jooservices Friend
    #746737

    Hi there
    You can check into source code of T3 for that.
    In logic if 3rd extension use alt way ( like system plugin hijack ) than of course T3 can’t catch it. 🙂
    Thank you,
    Viet Vu

    jooservices Friend
    #672846

    Hi there
    Here you are

    /**
    * Add T3 basic head
    *
    * @return null
    */
    function addHead()
    {

    $app = JFactory::getApplication();
    $user = JFactory::getUser();
    $input = $app->input;

    $responsive = $this->getParam('responsive', 1);
    $navtype = $this->getParam('navigation_type', 'joomla');
    $navtrigger = $this->getParam('navigation_trigger', 'hover');
    $offcanvas = $this->getParam('navigation_collapse_offcanvas', 0) || $this->getParam('addon_offcanvas_enable', 0);
    $legacycss = $this->getParam('legacy_css', 0);
    $frontedit = in_array($input->getCmd('option'), array('com_media', 'com_config')) //com_media or com_config
    || in_array($input->getCmd('layout'), array('edit')) //edit layout
    || (version_compare(JVERSION, '3.2', 'ge') && $user->id && $app->get('frontediting', 1) &&
    ($user->authorise('core.edit', 'com_modules') || $user->authorise('core.edit', 'com_menus'))); //frontediting

    // LEGACY COMPATIBLE
    if($legacycss){
    $this->addCss('legacy-grid'); //legacy grid
    $this->addStyleSheet(T3_URL . '/fonts/font-awesome/css/font-awesome' . ($this->getParam('devmode', 0) ? '' : '.min') . '.css'); //font awesome 3
    }

    // FRONTEND EDITING
    if($frontedit){
    $this->addCss('frontend-edit');
    }

    // Clear current css to put bootstrap css on top
    $_stylesheets = $this->_styleSheets;
    $this->_styleSheets = array();

    // BOOTSTRAP CSS
    $this->addCss('bootstrap', false);

    // Append current css to bootstrap
    $this->_styleSheets = array_merge($this->_styleSheets, $_stylesheets);

    // TEMPLATE CSS
    $this->addCss('template', false);

    if (!$responsive && $this->responcls) {
    // not responsive for BS3
    $this->addCss('non-responsive'); //no responsive

    $nonrespwidth = $this->getParam('non_responsive_width', '970px');
    if(preg_match('/^(-?d*.?d+)(px|%|em|rem|pc|ex|in|deg|s|ms|pt|cm|mm|rad|grad|turn)?/', $nonrespwidth, $match)){
    $nonrespwidth = $match[1] . (!empty($match[2]) ? $match[2] : 'px');
    }
    $this->addStyleDeclaration('.container {width: ' . $nonrespwidth . ' !important;} .t3-wrapper, .wrap {min-width: ' . $nonrespwidth . ' !important;}');

    } else if($responsive && !$this->responcls){
    // responsive for BS2
    // BOOTSTRAP RESPONSIVE CSS
    $this->addCss('bootstrap-responsive');

    // RESPONSIVE CSS
    $this->addCss('template-responsive');
    }

    // add core megamenu.css in plugin
    // deprecated - will extend the core style into template megamenu.less & megamenu-responsive.less
    // to use variable overridden in template
    if($navtype == 'megamenu'){

    // If the template does not overwrite megamenu.less & megamenu-responsive.less
    // We check and included predefined megamenu style in base
    if(!is_file(T3_TEMPLATE_PATH . '/less/megamenu.less')){
    $this->addStyleSheet(T3_URL . '/css/megamenu.css');

    if ($responsive && !$this->responcls){
    $this->addStyleSheet(T3_URL . '/css/megamenu-responsive.css');
    }
    }

    // megamenu.css override in template
    $this->addCss('megamenu');
    }

    // Add scripts
    if (version_compare(JVERSION, '3.0', 'ge')) {
    JHtml::_('jquery.framework');
    } else {
    $scripts = @$this->_scripts;
    $jqueryIncluded = 0;
    if (is_array($scripts) && count($scripts)) {
    //simple detect for jquery library. It will work for most of cases
    $pattern = '/(^|/)jquery([-_]*d+(.d+)+)?(.min)?.js/i';
    foreach ($scripts as $script => $opts) {
    if (preg_match($pattern, $script)) {
    $jqueryIncluded = 1;
    break;
    }
    }
    }

    if (!$jqueryIncluded) {
    $this->addScript(T3_URL . '/js/jquery-1.11.2' . ($this->getParam('devmode', 0) ? '' : '.min') . '.js');
    $this->addScript(T3_URL . '/js/jquery.noconflict.js');
    }
    }

    define('JQUERY_INCLUED', 1);

    // As joomla 3.0 bootstrap is buggy, we will not use it
    $this->addScript(T3_URL . '/bootstrap/js/bootstrap.js');
    // a jquery tap plugin
    $this->addScript(T3_URL . '/js/jquery.tap.min.js');

    // add css/js for off-canvas
    if ($offcanvas && ($this->responcls || $responsive)) {
    $this->addCss('off-canvas', false);
    $this->addScript(T3_URL . '/js/off-canvas.js');
    }

    $this->addScript(T3_URL . '/js/script.js');

    //menu control script
    if ($navtrigger == 'hover') {
    $this->addPageClass('mm-hover');
    }

    //if($navtrigger == 'hover' || $this->responcls){
    $this->addScript(T3_URL . '/js/menu.js');
    //}

    //reponsive script
    if ($responsive && !$this->responcls) {
    $this->addScript(T3_URL . '/js/responsive.js');
    }

    //some helper javascript functions for frontend edit
    if($frontedit){
    $this->addScript(T3_URL . '/js/frontend-edit.js');
    }

    //check and add additional assets
    $this->addExtraAssets();
    }

    Thank you,
    Viet Vu

    jooservices Friend
    #746738

    Hi there
    Here you are

    /**
    * Add T3 basic head
    *
    * @return null
    */
    function addHead()
    {

    $app = JFactory::getApplication();
    $user = JFactory::getUser();
    $input = $app->input;

    $responsive = $this->getParam('responsive', 1);
    $navtype = $this->getParam('navigation_type', 'joomla');
    $navtrigger = $this->getParam('navigation_trigger', 'hover');
    $offcanvas = $this->getParam('navigation_collapse_offcanvas', 0) || $this->getParam('addon_offcanvas_enable', 0);
    $legacycss = $this->getParam('legacy_css', 0);
    $frontedit = in_array($input->getCmd('option'), array('com_media', 'com_config')) //com_media or com_config
    || in_array($input->getCmd('layout'), array('edit')) //edit layout
    || (version_compare(JVERSION, '3.2', 'ge') && $user->id && $app->get('frontediting', 1) &&
    ($user->authorise('core.edit', 'com_modules') || $user->authorise('core.edit', 'com_menus'))); //frontediting

    // LEGACY COMPATIBLE
    if($legacycss){
    $this->addCss('legacy-grid'); //legacy grid
    $this->addStyleSheet(T3_URL . '/fonts/font-awesome/css/font-awesome' . ($this->getParam('devmode', 0) ? '' : '.min') . '.css'); //font awesome 3
    }

    // FRONTEND EDITING
    if($frontedit){
    $this->addCss('frontend-edit');
    }

    // Clear current css to put bootstrap css on top
    $_stylesheets = $this->_styleSheets;
    $this->_styleSheets = array();

    // BOOTSTRAP CSS
    $this->addCss('bootstrap', false);

    // Append current css to bootstrap
    $this->_styleSheets = array_merge($this->_styleSheets, $_stylesheets);

    // TEMPLATE CSS
    $this->addCss('template', false);

    if (!$responsive && $this->responcls) {
    // not responsive for BS3
    $this->addCss('non-responsive'); //no responsive

    $nonrespwidth = $this->getParam('non_responsive_width', '970px');
    if(preg_match('/^(-?d*.?d+)(px|%|em|rem|pc|ex|in|deg|s|ms|pt|cm|mm|rad|grad|turn)?/', $nonrespwidth, $match)){
    $nonrespwidth = $match[1] . (!empty($match[2]) ? $match[2] : 'px');
    }
    $this->addStyleDeclaration('.container {width: ' . $nonrespwidth . ' !important;} .t3-wrapper, .wrap {min-width: ' . $nonrespwidth . ' !important;}');

    } else if($responsive && !$this->responcls){
    // responsive for BS2
    // BOOTSTRAP RESPONSIVE CSS
    $this->addCss('bootstrap-responsive');

    // RESPONSIVE CSS
    $this->addCss('template-responsive');
    }

    // add core megamenu.css in plugin
    // deprecated - will extend the core style into template megamenu.less & megamenu-responsive.less
    // to use variable overridden in template
    if($navtype == 'megamenu'){

    // If the template does not overwrite megamenu.less & megamenu-responsive.less
    // We check and included predefined megamenu style in base
    if(!is_file(T3_TEMPLATE_PATH . '/less/megamenu.less')){
    $this->addStyleSheet(T3_URL . '/css/megamenu.css');

    if ($responsive && !$this->responcls){
    $this->addStyleSheet(T3_URL . '/css/megamenu-responsive.css');
    }
    }

    // megamenu.css override in template
    $this->addCss('megamenu');
    }

    // Add scripts
    if (version_compare(JVERSION, '3.0', 'ge')) {
    JHtml::_('jquery.framework');
    } else {
    $scripts = @$this->_scripts;
    $jqueryIncluded = 0;
    if (is_array($scripts) && count($scripts)) {
    //simple detect for jquery library. It will work for most of cases
    $pattern = '/(^|/)jquery([-_]*d+(.d+)+)?(.min)?.js/i';
    foreach ($scripts as $script => $opts) {
    if (preg_match($pattern, $script)) {
    $jqueryIncluded = 1;
    break;
    }
    }
    }

    if (!$jqueryIncluded) {
    $this->addScript(T3_URL . '/js/jquery-1.11.2' . ($this->getParam('devmode', 0) ? '' : '.min') . '.js');
    $this->addScript(T3_URL . '/js/jquery.noconflict.js');
    }
    }

    define('JQUERY_INCLUED', 1);

    // As joomla 3.0 bootstrap is buggy, we will not use it
    $this->addScript(T3_URL . '/bootstrap/js/bootstrap.js');
    // a jquery tap plugin
    $this->addScript(T3_URL . '/js/jquery.tap.min.js');

    // add css/js for off-canvas
    if ($offcanvas && ($this->responcls || $responsive)) {
    $this->addCss('off-canvas', false);
    $this->addScript(T3_URL . '/js/off-canvas.js');
    }

    $this->addScript(T3_URL . '/js/script.js');

    //menu control script
    if ($navtrigger == 'hover') {
    $this->addPageClass('mm-hover');
    }

    //if($navtrigger == 'hover' || $this->responcls){
    $this->addScript(T3_URL . '/js/menu.js');
    //}

    //reponsive script
    if ($responsive && !$this->responcls) {
    $this->addScript(T3_URL . '/js/responsive.js');
    }

    //some helper javascript functions for frontend edit
    if($frontedit){
    $this->addScript(T3_URL . '/js/frontend-edit.js');
    }

    //check and add additional assets
    $this->addExtraAssets();
    }

    Thank you,
    Viet Vu

Viewing 13 posts - 1 through 13 (of 13 total)

This topic contains 13 replies, has 2 voices, and was last updated by  jooservices 8 years, 8 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum