al3bed
10-05-2009, 10:56 PM
hello,
I face a performance problem with postbit_display_complete hook. this hook can't read from other hooks such as global_start and parse_templates? also this hook can't replace str from forum templates? I used a fetch_array function in parse_templates to declare variables fetching a template like below:
/* ADS VARIABLES */
$vbulletin->db->hide_errors();
$ain_info = $vbulletin->db->query_read("
SELECT id, type, content, slot, channel, width, height
FROM " . TABLE_PREFIX . "ainads AS ainads
ORDER BY id ASC ");
while ($ain_data = $vbulletin->db->fetch_array($ain_info))
{
$ainads_doneid = $ain_data[id];
eval('$ain_ads[$ainads_doneid] .= "' . fetch_template('ain_showads') . '";');
}
$vbulletin->db->show_errors();
/* END ADS VARIABLES */
this will give me 3 queries executed in normal case if I have 3 raws of data.
but if i but this code in postbit hook will execute each time postbit show.. so
if I have a 10 posts within the page it's will give me 3*10= 30 queries! too much
how can I solve this? I want to use the variables templates called by postbit_display_complete, but they don't work if I don't but the code in the hook.
hope it's clear enough?
sorry for my bad english
thanks
I face a performance problem with postbit_display_complete hook. this hook can't read from other hooks such as global_start and parse_templates? also this hook can't replace str from forum templates? I used a fetch_array function in parse_templates to declare variables fetching a template like below:
/* ADS VARIABLES */
$vbulletin->db->hide_errors();
$ain_info = $vbulletin->db->query_read("
SELECT id, type, content, slot, channel, width, height
FROM " . TABLE_PREFIX . "ainads AS ainads
ORDER BY id ASC ");
while ($ain_data = $vbulletin->db->fetch_array($ain_info))
{
$ainads_doneid = $ain_data[id];
eval('$ain_ads[$ainads_doneid] .= "' . fetch_template('ain_showads') . '";');
}
$vbulletin->db->show_errors();
/* END ADS VARIABLES */
this will give me 3 queries executed in normal case if I have 3 raws of data.
but if i but this code in postbit hook will execute each time postbit show.. so
if I have a 10 posts within the page it's will give me 3*10= 30 queries! too much
how can I solve this? I want to use the variables templates called by postbit_display_complete, but they don't work if I don't but the code in the hook.
hope it's clear enough?
sorry for my bad english
thanks