I made a page (eg ?q=overview) with a [view:players] in it. The players-view (in table format) has an argument "team" (eg Men1, Men2, Women1, Boys1, ...). With this view I can call ?q=players/Men1 to display all players from team "Men1".

But when I call the page ?q=overview/Men1 is give "Page not found".

I'm not sure whether to call it a bug or a feature request.

Comments

merlinofchaos’s picture

What's the 'default' setting on that argument? That is what use Views to determine behavior if an argument is not provided. If you haven't set that or changed it, it defaults ot 'page not found' when you probably want either 'summary view' or 'show all values'.

tmp’s picture

Hey Merlin,

I have setup an example here : http://drupal.org/node/76622

The argument is set to "Display all values".

If you want I can give you access to my test site

merlinofchaos’s picture

Ohh! I understand.

Ok, you will need to use PHP to do what you want to do, now that I get it.

  $players = views_get_view('players');
  $games = views_get_view('games');
  $arg = array();
  if (arg(1)) {
    $arg[] = arg(1);
  }
  print views_build_view('embed', $players, $arg, false, $players->nodes_per_page);
  print views_build_view('embed', $games, $arg, false, $games->nodes_per_page);

That should work, permitting typos etc.

tmp’s picture

Thanks for looking into it.

I pasted your code in a page : http://cordoba.sohosted.com/drupal/index.php?q=test_overview
This displays the empty message.

Adding an argument (?q=test_overview/Men1) displays "Page not found" : http://cordoba.sohosted.com/drupal/index.php?q=test_overview/Men1

merlinofchaos’s picture

Aw crap. That code won't work in a node because of the way aliasing works.

Uh. You probably need to make a module and make it real page.

tmp’s picture

Hey Merlin,

I have no PHP skills (yet) so I will log this as a feature request for now.

tmp’s picture

While reading the README file of insert_view I came across this :

TODONE
------
Add support for arguments? [view:viewname=5=arg1,arg2,arg3] is one possible syntax ...

This would be great aswell !!

RayZ’s picture

And looking at the code, I believe this has been implemented.

michelle’s picture

It has; that argument syntax works fine. Glad to see I'm not the only one who got confused by the "TODONE" :)

Michelle

tmp’s picture

Lol, thanks for pointing that out !! This feature will make my Drupal implementation a lot easier. But my initial feature request still stands ;-)

Indeed you can use [view:viewname=5=arg1] now. But I noticed that the number of nodes to display is mandatory, this [view:viewname=arg1] does not work.

jamesJonas’s picture

Thanks for a great feature. Use of arguments is a great way to customize page content using views in context.

I'm not quite clear on the syntax.

[view:viewname=5=arg1,arg2,arg3]

Does this mean arg1 = 5 AND arg2 = 5 AND arg3 = 5 ?

Or are agr2 and arg3 passed via the URL...

James

RayZ’s picture

The 5 is the number of nodes to display and arg1, arg2, arg3 are the values you want to pass to the view as args. For example, you would do something like ...

[view:my_events_view=10=2006,09]

... to display the first 10 events for Sept 2006, if you had an view called 'my_events_view' set up to take the year and month as args.

mlsamuelson’s picture

@double2: You can leave the number of nodes to display blank, but you do need to have the = in there for it.

Some examples:

[view:viewname=5=arg1] will give you 5 nodes for viewname using arg1

without limiting the number of nodes:
[view:viewname=arg1] incorrect
[view:viewname==arg1] correct - will give you all nodes for viewname using arg1

mlsamuelson

zmove’s picture

Hi,

And how do I declare an insert view to use multiple arguments ?

I tried :

[view:viewname=4=arg1,arg2,arg3,arg4] => it show only one result
[view:viewname==arg1,arg2,arg3,arg4] => it show only one result too...

mlsamuelson’s picture

@zmove:

Your Insert View tag syntax is correct. Have you double-checked your views configuration?

mlsamuelson

summit’s picture

Bookmarking, so using Insertview in a node can have arguments from the url, great!
how about performance issues, if you need it on several places.

greetings,
Martijn

pasqualle’s picture

Status: Active » Closed (fixed)

closing all D5 issues

you can use arguments from url