Hi, let me help you with some code (very simplified):
PHP Code:
function banners($query_string){
// 1-select your banner using $query_string
// You shoud have something like this, dependimg on your AdServer
$query_ini ='SELECT DISTINCT B.bid, B.url, B.text
FROM '.$prefix.'_banner_imp3 AS B
WHERE B.keyword LIKE \'%'.trim($query_string).'%\'';
$bresult = @mysql_query($query_ini);
// Count banner
$numrows = @mysql_num_rows($bresult);
// 2-format your results in a string
// variable using html
if ($numrows > 0) {
$html = '<b>Sonsored links</b> <br>'
while (list($bid,$url, $text)=mysql_fetch_row($bresult){
$html .="<a href=$url>$text</a><br>";
// do other things
}
}
// 3- return this variable
return $html;
}
So, you have to implement the function banners() accordingly with your AdServer (NOT present in Phpdig, try PhpAdsNew or others).
That function is called during a search and the html code is passed to the template:
PHP Code:
search_function.php, lines around 460
if($query_string AND SPONSORED_LINKS != -1)
$banner['adbanner'] = banners($query_string);
$t_strings = array_merge($t_mstrings,$t_fstrings, $banner);
phpdigParseTemplate($template,$t_strings,$table_results);
Finally you have to print the html code in the template wherever you want
<!-- sponsored link -->
<phpdig:adbanner/>
that's all