[support] Views parameters canceling each other out?

Steve Edwards killshot91 at comcast.net
Mon Jun 9 22:38:52 UTC 2008


I'm working on a site for a city, and the city is broken down into it's 
different areas/departments.  The page for each department has it's own 
view for its main page.  For each piece of content, there are two 
taxonomy categories: one to indicate which department it does under, and 
one that indicates the type of information.  What we need to do is have 
a block that shows the relevant content of a certain type for the 
specific department.  So for instance, on the Police department page, I 
want to have a block that shows content with type 'form' and a 
department of 'police'.  Since 'police' is the URL for the view (i.e. 
mysite.com/police on the Police page) and not an argument, I use the 
following code to add the view URL as an argument:

$path = $_GET['q'];
$searchchar = '/';
$slash = strpos($path, $searchchar);
//get first item in path
//if there is no '/' in $path, use $path
if (strpos($path, $searchchar) === FALSE) {
  $subsite = $path;
}
else { //there was a slash, so we're assuming is it in the format node/xxxx
  $part1 = substr($path, 0, $slash);
  $sql = "SELECT dst FROM {url_alias} WHERE src = '%s'";
  $alias = db_result(db_query($sql, $path));
  $subsite = substr($alias, 0, strpos($alias, $searchchar));
}
$args[0] = $subsite;

I then have an argument that uses %1 from the URL.

This code works perfectly by itself.   The problem comes when I add a 
filter to narrow down by type using the second taxonomy term.  If the 
filter is by content type, it works fine and both criteria are used.  If 
however, the second filter is also by taxonomy term for the type 
vocabulary, then the block doesn't show at all.  If I just use one or 
the other (the argument code or the filter by type vocabulary), the 
block shows up, but obviously only with more nodes displayed than I 
want.  It's almost as if the two parameters (the argument and the 
filter) are canceling each other out.  Can anyone verify if this is 
true?  Is there a better way to do what I'm trying to do?

Thanks.

Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20080609/7f51bf36/attachment.htm 


More information about the support mailing list