This is a Views 6.x-2.x problem: On a site with many different views (many of which are blocks included in Panels that pass arguments to blocks) I would like to filter views by a taxonomy term depending on the domain the site is visited through. This filtering should be additional to a first argument (taxonomy term).
The site is configured to work with different domains, let's say example1.com and example2.com. I want to "connect" those domains to the taxonomy terms 45 and 115.
So for example:
example1.com/my_view/1 Should show all nodes that have term 1 and term 45.
example2.com/my_view/1 Should show all nodes that have term 1 and term 115.
My approach was to add a second argument (the first is the default taxonomy term ID argument). As default argument I use the following snipped in the argument handling code:
<?php
// Get domain.
$host = preg_match('/[^.]+\.[^.]+$/', $_SERVER['HTTP_HOST'], $hit);
$host = $hit[0];
// Select taxonomy term.
if ($host == 'example1.com'){
$taxonomy = '45';
} elseif ($host == 'example2.com'){
$taxonomy = '115';
}
return $taxonomy;
?>
This works when I use a page display with the path my_view/% (making only the first argument mandatory). But when I use it in a panel, I just get an empty view (if "no context" is chosen) or the second argument doesn't have any effect (if "term id of first/all term" is chosen).
Any ideas what could be wrong? I have really tried a lot.