Welcome to Geeklog, Anonymous Friday, November 22 2024 @ 11:47 pm EST
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
{
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
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
19
28
Quote
Status: offline
Laugh
Site Admin
Admin
Registered: 09/27/05
Posts: 1470
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.
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.
13
14
Quote
Status: offline
mystral-kk
Site Admin
Admin
Registered: 03/19/06
Posts: 100
Location:Japan
Hi Ben,
How about changing
to
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."
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."
12
13
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
//$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
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
10
10
Quote
All times are EST. The time is now 11:47 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