Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 04:41 pm EDT

Geeklog Forums

plugin_getheadercode cache issue


Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Hi,

As in others plugins I'm using this function to add css and js to paypal plugin
Text Formatted Code
function plugin_getheadercode_paypal()
{
        global $_CONF, $_PAY_CONF;

        $retval = '<link rel="stylesheet" href="' . $_CONF['site_url'] . '/paypal/css/paypal.css?ver=115" type="text/css" media="screen"' . XHTML . '>' . LB;
        $retval .= '<link rel="stylesheet" href="' . $_PAY_CONF['site_url'] . '/css/jcart.css?ver=115" type="text/css" media="screen"' . XHTML . '>' . LB;
        $retval .= '<script type="text/javascript" src="' . $_PAY_CONF['site_url'] . '/js/jcart-javascript.php"></script>' . LB;
       
        if(!defined('JQUERY')){
        $retval .= '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>'. LB;
                $retval .= '<script>
    if(jQueryNoConflict == undefined){
    jQuery.noConflict();
    var jQueryNoConflict = true;
    }
</script>'. LB;

        define('JQUERY', 'true');
    }

        return $retval;
}
 


but don't know why, css files are reloaded with every page and increase the page load time.

My question is, why these files are not cached like other css files from plugins such as Polls or Links?

::Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1468
Location:Canada
Ever since Suprsidr released his excellent Twitter plugin I had wanted to devise away to minimize loading of all the css and javascript files not needed for the page being currently viewed.

For example, the only thing that uses the Twitter plugin on one of my sites is the about us page and that is the only thing that uses jquery. It seems like a waste of resources to me by Geeklog of having jquery loaded for every single page (let alone it's css file).

This problem was one of those things I had wanted to look into but haven't had the time yet.

One of the Geeklog Core Developers.
 Quote

Status: offline

mystral-kk

Site Admin
Admin
Registered: 03/19/06
Posts: 100
Location:Japan
Hi Ben,

How about changing

Text Formatted Code
$retval = '<link rel="stylesheet" href="'  . $_CONF['site_url'] . '/paypal/css/paypal.css?ver=115" type="text/css" media="screen"' . XHTML . '>'  . LB;


to

Text Formatted Code
$retval = '<link rel="stylesheet" href="'  . $_CONF['site_url'] . '/paypal/css/paypal.css" type="text/css" media="screen"' . XHTML . '>'  . LB;


If you add a query string to a URL, it is treated as a dynamic content , even if it is just a static CSS file. So, try removing the "?ver=115".
-- mystral-kk, "Every cloud has a silver lining."
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
There is surely something else to do because removing the parameter ver=115 do not increase speed loading. Even a blanck css do not improve it. The only way I founded is to disable the css Cry

Text Formatted Code
       
//$retval = '<link rel="stylesheet" href="' . $_CONF['site_url'] . '/paypal/css/paypal.css" type="text/css" media="screen"' . XHTML . '>' . LB;
//$retval       .= '<link rel="stylesheet" href="' . $_PAY_CONF['site_url'] . '/css/jcart.css" type="text/css" media="screen"' . XHTML . '>' . LB;


With css enable, loading time is about 10-20 seconds. Without, css loading time is 0,6 seconds :banghead:

Edit: Very strange, seems to be a browser issue. FireFox 3.6.6

I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

All times are EDT. The time is now 04:41 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content