Closed (fixed)
Project:
Boost
Version:
6.x-1.x-dev
Component:
Caching logic
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
6 Jul 2009 at 20:49 UTC
Updated:
7 Jul 2009 at 06:48 UTC
Hi
I tried boost yesterday but i found that it doesn't work well with my module
My module logic - on mouse over of any link to user, it did ajax load of some user content profile data (name, age, city) and show it into a popup bubble. On mouse out, the bubble disappear.
With boost correctly enabled, I got javascript erron on mouse over of link to any user account.
Can you please give to me a hint, how to do some exception for this module or this requests?
This is part of code of my module
function userbubble_menu() {
$items = array();
$items['userbubble'] = array(
'path' => 'userbubble/ajax',
'page callback' => 'callAjax',
'access arguments' => array('userbubble user access'),
'type' => MENU_CALLBACK,
);
return $items;
}
function callAjax() {
if ( arg(0) && arg(0) == 'userbubble' && arg(1) && arg(1) == 'ajax' && is_numeric(arg(2)) ) {
$wanted_user = user_load( array('uid' => arg(2)) );
$uid = $wanted_user->uid;
}
$loadedUser = user_load(array('uid' => $uid));
$name = $loadedUser->name;
$sql = "SELECT n.nid, n.uid FROM node n WHERE (n.type = 'uprofile' AND $uid = n.uid)";
$result = db_query($sql);
$row = db_fetch_object($result);
$node_loaded = node_load($row->nid);
$sex = content_format('field_profil_pohlavie_2', $node_loaded->field_profil_pohlavie_2[0], 'default', $node_loaded);
$base_path = base_path();
printf ( '{ "uid" : "%s", "icon" : "%s", "name" : "%s", "forename" : "%s", "age" : "%s", "from" : "%s", "sex" : "%s", "photo" : "%s", "počet kamarátov" : "%s", "msg_link" : "%s", "profil_link" : "%s" }',
//get datas from predefined CCK fields
content_format('field_profil_krstne_meno', $node_loaded->field_profil_krstne_meno[0], 'default', $node_loaded),
...
);
}
Thank you
Igor
http://www.somvprahe.sk
Comments
Comment #1
mikeytown2 commentedWhat are the JS errors (firebug)? Are you doing a post or a get request? Is the menu path
userbubble/ajax/*excluded from the boost cache, under Boost cacheability settings?btw, this looks like it is doing a full drupal bootstrap to get the info, I would recommend refactoring your code so it's faster. See boost_stats.php for a 1/2 done example; and here are some of the issues in regards to this.
#505766: Does this support the Who's online block?
#503628: AJAX Load stats
#506906: Support node read count display
Comment #2
mikeytown2 commentedYour server does a GET, means it could be cached by boost... which could be the issue since boost adds in
!-- Page cached by Boost @ ...tag to the bottom of almost everything it caches. Looks like drupal is retuning JSON. Could you see if boost is adding the!-- Page cached by Boost @ ...tag to your ajax requests?firebug output
Comment #3
mikeytown2 commentedComment #4
igorik commentedHi Miky
thanks for reply.
I am not sure about your question about ajax request - I think that it is exactly what is in firefox output you posted. There is no other info except this:
the code of my ajax request in my module js is this:
However, today I found that the bug is in Internet explorer 8, only. (IE 6 and Firefox is ok) So, maybe it is not problem of Boost. (In this case I am sorry for missunderstanding you)
Ithe javascript error in IE 8 was
Then I turned off Javascript optimizing and minimizing on performance page, but then the new error appears:
what is weird because the script is running ok. So, it could be really some problem with IE8 javascript engine... I hope so.
I tried use $.post, as you wrote in your first post, and with $.post it works without problems.
I am not sure if there is better to use get or post in my case, or if it the same and there is no performance difference.
With $.post what means without Boost caching, it works fine, what is great. Thanks again. I have own cache for json object, - I add it into object, and if that object exists, I load it without new json request.
Thanks for the info about bootstrap too, I will look at it today, but currently I don't load bootstrap specially (no function for bootstrap in my module), just basic use a module. The id of a user is added into user link or user picture by theme_function - from $account (I did there some small changes). With uid in user link, i can to do on mouse over load user for that uid, by this module and take some info from his profile. But I am beginner in module development, so probably there could be a lot of things done better :)
Thank you again and have a nice day.
Igor
Comment #5
mikeytown2 commentedtry adding a
;to the end of your eval statement, it could fix the error.eval('var replyObj = ' + data + ';');//line 54In any case this doesn't belong on boosts issue queue; if your encountering more issues with your module, I recommend asking for help in the support forum. Default is a full bootstrap; all I'm saying is your server is melting from load, I would look into using a lighter bootstrap in your module.