Anyone knows how to pass multiple arguments from Panels into a view in Drupal 6?
Edit: I know how to pass one argument from Panels into Views, but not multiple arguments.
In the panels argument field, separate them with a "/"
Something like arg1/arg2/arg3
The main thing is to save your view as a panel pane. Good instructions here
In your tutorial you use site.ru/% path for panel, so this means that you use the variable % as argument. If you write site.ru/%1/%2, you can use two argument's variable %1 and %2.
Related
I am using the quicktab module and at some tabs I pass in a view (to which I added some arguments).
I tried setting the arguments (which are 2 booleans) to 1/0 and it doesn't work, it displays all the values instead of filtering it. If I use the view in a block and set the arguments there to 1/0 it filters them properly.
Am I doing something wrong? Or does this feature not work with the quicktabs?
I recently did the same, but instead of using the arguments of quicktabs, I used the arguments in views. Together with the context module, that suited for me. Hope this helps you :-)
I'm currently using Drupal Views 2 to build custom views. This works fine so far, if there wasn't a feature needed: One should be able to filter the results by different fields via URL, in the form of:
http://domain/node/M/[key]:[value],[key2]:[value2],...,[keyN]:[valueN]
The key names are fixed and may not be altered.
I tried hooking hook_views_query_alter() and hook_views_pre_render() to generalize this for all views, evaluating the given filterset, but to no satisfying end, as i could not get hold of the query used to build the view (I could not alter it in the proper way, as i do not know the field names in the query).
The question is, if there is a nicer way to implement such a filterset.
thanks in advance,
flo
Looking at the comments you seem to want not only url arguments but url arguments in a custom format.
I would firstly urge you to drop your format and use the standard views argument format, this will be more standards compliant and save you a lot of headache.
If you want to use that paticular format you are going to have to write some custom code in a module.
Register a callback using hook_menu().
In that callback use arg() and decode your arguments.
Pass the arguments to views_embed_view(). as shown here
How can I affect the delta parameter value? Where it can be set?
I'm beginner with Drupal but know my way around PHP and other CMS apps e.g. Joomla. I've working on my first drupal module and need to create a module with multiple blocks. I know how to switch based on the $op parameter but the $delta value seems always to be the default value set in the function declaration.
How can I select which block to process and display? Can $delta be set so that when using modules subnavigation is uses delta to switch to another block view?
Thanks in advance.
hook_block() is used for defining a and displaying blocks. You define the delta when you are producing the data for $op='list' this is passed back to the hook when it it is called for $op='view'.
the $delta argument will therefore be whatever you define. If you define the keys in your list array as red, green and blue that is what will be passed if the block is displayed.
Maby looking at the example will help you.
In Drupal I am working with a view that takes a couple of arguments; the nid argument is just passes along to the next page, but the other three arguments it uses to retrieve content. The problem seems to be that the view uses all arguments to retrieve content, which obviously doesn't work since the presence of nid will always return one single row.
So how do i perform the search (retrieve the content pages) using the three arguments while leaving nid intact as it needs to be passed to another page?
If I understand correctly, the first argument is a nid, and you want that argument to have no effect on the outcome of the view (no filtering)?
If so, adjust the Validator options for the first (nid) argument.
Set Validator to PHP Code.
Leave PHP validate code blank and the argument will always be considered invalid.
Set Action to take if argument does not validate to Display all values.
This will have the effect of ignoring the first argument.
I have a Panel page, which I have given a path of: books/travel-books/%city/%country/%page. The help text underneath the field says "The URL path to get to this page. You may create named placeholders for variable parts of the path by using %name for required elements and !name for optional elements. For example: "node/%node/foo", "forum/%forum" or "dashboard/!input". These named placeholders can be turned into contexts on the arguments form.", so I have named my arguments appropriately.
So now in my code, I need to get the values of those arguments. I've seen arg(0), but that requires me knowing which index the argument has. Is there anyway to access it by the name I gave it in the path? Something like arg('city')??
The reason being, that I need to have similar path arguments on many pages, and need to access the values of these in my module. But the arguments may be in different places for another page. For instance, another page might be at: flights/%city/%country. Then I want to access the city argument within the same function, but it is at a different index.
Can anyone help?
you can check for arg(0) first, see whether it is 'books', 'flights', whatever... then associate names accordingly. do it as a helper function in a custom module and call it before referencing (wherever you're referencing it).
The text that you quoted from the panels help text is referring to what panels call context.
Panels
Panels has a great use if you want to aware of what context a certain piece of content is being viewed. Fx if you had several shops with different products, you might want to control which blocks in a sidebar would be displayed, based on the shop that the product belonged to.
This is essential what context is in panels and what the named placeholdes are used for. You can be default add different kinds of context, fx nodes, users, taxonomy terms. You can then use the different pieces of context if various ways.
If panels default options is not enough, you can also create your own plugins to panels to make it handle your special cases. But it requires a lot of time to learn how panels work.
Other solutions
Using panels might not be the easiest option for you, it depends what you are aiming for. But if you don't need to make pages that is aware of the context, this would probably be a lot easier to do with views and theming. Views can handle arguments in urls very well, and it is a lot simpler to both style and configure.
In Drupal 7 you can get the arguments from hook_content_type_render
function <your plugin name>_content_type_render($subtype, $conf, $panel_args, $context) {
$block = new StdClass;
$block->title = t('test');
$block->content = 'test panel arg: '.$panel_args[0];
return $block;
}
Custom panel tutorial