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
Quoting Steve Edwards killshot91@comcast.net:
Is there a better way to do what I'm trying to do?
How about using Organic Groups[1] and have each department be a group. There are a number of modules[2] just for Organic Groups.
[1] http://drupal.org/project/og [2] http://drupal.org/project/Modules/category/90
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
Yes, I would agree. Matt Westgate made that suggestion to us at a Drupal camp a few weeks ago, but unfortunately this project (not mine, I'm just helping out) is too far along to convert to OG.
Steve
Earnie Boyd wrote:
Quoting Steve Edwards killshot91@comcast.net:
Is there a better way to do what I'm trying to do?
How about using Organic Groups[1] and have each department be a group. There are a number of modules[2] just for Organic Groups.
[1] http://drupal.org/project/og [2] http://drupal.org/project/Modules/category/90
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/