0
votes

I currently have a view (Drupal 6 using Views2) that properly aggregates a custom content type (videos) and filters them for a page display. When I create a block display, it previews the results in live preview just great, but when i go to the page expecting to see the block it doesn't appear.

I'm fairly certain the argument I'm attempting to pass it fails because when I select "Display all results" for "Action to take if argument does not validate:" the block shows up on the page just fine.

Any advice definitely appreciated.

2
How do you give the argument to the block? through the url or do you print the view in a tpl.php and pass arguments? - Jozzeh
I think I'm passing it through the url, on the Block Display I added an Argument for Term and then I'm providing a Default Argument which is set to Taxonomy Term ID from URL. But it doesn't seem to work the way I am expecting it to, works in the Live Preview great, just not when I browse the page. - slimcady
So the block is being displayed on a taxonomy listing page? - Grayside
I gave up on trying to place a block and instead just styled a page display instead. - slimcady

2 Answers

2
votes

you can use PHP code in the 'provide default argument' section. assuming you're using a menu callback to apply the argument you can do this:

<?php

if(args(0) == 'your-menu-path' && args(1) != ''){
    return args(1)
}

?>

make sure you pass a default argument to 'views-embed-view()' if you're using it to place the view on your page otherwise it won't show up at all.

0
votes

In Drupal 7, to figure out the node you're on, follow corneliusk's answer about making it your default argument. However, do NOT include the php tags, and it's just "arg" not "args" for d7. Ex:

if(arg(0) == 'node' && arg(1) != ''){
    return arg(1);
}
else {
  return "";
}