Hi. I've been trying to get an argument passed onto a block (though at this point I would be happy just passing an argument). I am using php to decompose a clean url, putting it into an array and then using a conditional to determine and set the argument. A little background on the site, I want to have a list of beers and who brews them. On a brewer's page I want all of the beers brewed by that company in a block on the page. So I want to do the argument from (field_beers_brewer), my fields in the view are node titles and field_beer_brewers and I am filtering just the custom content type "beers". From what I have learned so far I believe this is the correct approach. Here is the code.
$path = drupal_get_path_alias($_GET['q']);
$path = explode('/', $path);
if ($path[0] == 'brewer' )
{
return $path[1];
}
when in the page I am getting no useful output. using the preview section on the views I am seeing some odd happenings. I enter in the arguments "brewer/guiness" I feel that this code should return the argument "guiness" however this is the query generated.
SELECT node.nid AS nid,
node.title AS node_title,
node_data_field_beer_brewer.field_beer_brewer_value AS node_data_field_beer_brewer_field_beer_brewer_value,
node_data_field_beer_brewer.nid AS node_data_field_beer_brewer_nid,
node.type AS node_type
FROM node node
LEFT JOIN content_type_beer node_data_field_beer_brewer ON node.vid = node_data_field_beer_brewer.vid
WHERE (node.type in ('beer')) AND (node_data_field_beer_brewer.field_beer_brewer_value = 'brewer')
the last line I see it is trying to search for the first argument. Also if i use %1 in the title, I get "brewer" if I used %2 I expect to get "guiness" but I just get "%2", anything hear glaringly obvious here that I'm doing wrong?
Comments
Does anyone have at least a
Does anyone have at least a similar problem? I've tried all things I could think of to debug this, nothing is working however.
Hi, You really have to figure
Hi,
You really have to figure out working with arguments. %2 is for argument 2 and %1 is for argument 1.
So you need to set your views2 view accordingly. You can't use %1 for argument 2...
Then the preview would show you the query where you can figure out what to do.
May be getting into the views2 documentation would serve you a lot of good also!
Greetings,
Martijn
ok, but i my case the
ok, but i my case the Argument need to be Taxonomy Term and alias is differnet the taxonomy,
example of one of my taxonomy, 'artist':
i have Robbie Williams
but in the path is robbie-williams
how can i solve that coz it is obviously did not match! what is taxonomy structure for that?
I finally got my problem
I finally got my problem working. I had a similar problem with a special character I ran the php function str_replace I think, look it up and it can replace that hyphen with a space