I have a phpAdsNew rotation on the site revoked by remote JS. And it works.

However, what I would need to do is switch banner zones displayed according to the taxonomy section, ie.

www.mydomain.com/hair/ (?q=hair) so that all subcategories (ie. q=hair/styles) and nodes (ie. hair/styles/hairdresser) belonging to the hair section use the same code snippet ie. include a different JS.

Can you give me an advice on the approach and especially on the IF clause for the taxonomy?

Thanks ;)

Comments

robertdouglass’s picture

/**
 * Finds all nodes that match selected taxonomy conditions.
 *
 * @param $tids
 *   An array of term IDs to match.
 * @param $operator
 *   How to interpret multiple IDs in the array. Can be "or" or "and".
 * @param $depth
 *   How many levels deep to traverse the taxonomy tree. Can be a nonnegative
 *   integer or "all".
 * @param $pager
 *   Whether the nodes are to be used with a pager (the case on most Drupal
 *   pages) or not (in an XML feed, for example).
 * @return
 *   A resource identifier pointing to the query results.
 */
function taxonomy_select_nodes($tids = array(), $operator = 'or', $depth = 0, $pager = TRUE) {

and

/**
 * Find all children of a term ID.
 */
function taxonomy_get_children($tid, $vid = 0, $key = 'tid') {

- Robert Douglass

-----
visit me at www.robshouse.net

SupaDucta’s picture

OK, did the first part.

The zone code, for example is this:

<script type='text/javascript'>
<!--
if (!document.phpAds_used) document.phpAds_used = ',';
phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);

document.write ("<" + "script type='text/javascript' src='");
document.write ("http://www.mydomain.com/external/phpadsnew/adjs.php?n=" + phpAds_random);
document.write ("&what=zone:1");
document.write ("&exclude=" + document.phpAds_used);
if (document.referer)
document.write ("&referer=" + escape(document.referer));
document.write ("'><" + "/script>");
//-->
</script><noscript><div><a href='http://www.mydomain.com/external/phpadsnew/adclick.php?n=aa1b1f77'><img src='http://www.mydomain.com/external/phpadsnew/adview.php?what=zone:1&n=aa1b...' alt='' /></a></div></noscript>

This is an example of phpAdsNew code for zone 1, slightly modified for the whole page to validate as XHTML Strict.

So not to include the whole piece of code, I have actually set the zone:1 and n=aa1b1f77 to variables that are later handled in a template using {adzone} and {adn} tags:


<script type='text/javascript'>
<!--
if (!document.phpAds_used) document.phpAds_used = ',';
phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);

document.write ("<" + "script type='text/javascript' src='");
document.write ("http://www.mydomain.com/external/phpadsnew/adjs.php?n=" + phpAds_random);
document.write ("&what=zone:{adzone}");
document.write ("&exclude=" + document.phpAds_used);
if (document.referer)
document.write ("&referer=" + escape(document.referer));
document.write ("'><" + "/script>");
//-->
</script><noscript><div><a href='http://www.mydomain.com/external/phpadsnew/adclick.php?n={adn}'><img src='http://www.mydomain.com/external/phpadsnew/adview.php?what=zone:{adzone}&n={adn}' alt='' /></a></div></noscript>

because that's all that needs to change regarding to the terms.

So to begn with I have put this in the function xtemplate_page in xtemplate.xtmlp:


$adzone = "1";
$adn = "aa1b1f77";    

$xtemplate->template->assign("adzone", $adzone);
$xtemplate->template->assign("adn", $adn); 

And this part works. But, I can't figure how to put the conditions here and how to use functions In your reply.

I would need to do this in words:

If q=hair or hair/something
$adzone = "1";
$adn = "aa1b1f77";

else if q=banana or banana/boat
$adzone = "5";
$adn = "ae833b0b";

and basically it would hard-code the banner zone switching.

Cases I would need are: q=banana (term), banana/boat (term with child) and banana/boat/sunken (node). The whole three cases would in fact use the same zone.

How to do it, the rest is too complicated for me?

Thanks a lot ;)

SupaDucta’s picture

Robert (or any of the guys), I can't pay much, but we can arrange for a fee if someone would help us do this, and of course a reference in the impressum of the website that uses this with a hyperlink.

I believe it wouldn't take too much of your time, so if anyone is interested in helping out here, please mail me at senker [AT] post [DOT] htnet [DOT] hr .

SupaDucta’s picture

Come on guys, this will be paid...