1

Hello Drupal enthusiasts,

I have a menu structure, which has its equivalent in url paths. Example: department/area/project. This path works fine and now I want to attach some View when last part of url is "releases" (department/area/project/releases).

Any ideas? Should I rather take closer look at Views options or some other module (Pages?) or programatically by hook_menu and some wildcards?

========================================================= EDIT (thanks to lack of ability of answering my own question): I think I figured out something close to what I need. I create View, type Attachment (thanks to EVA module). I configure contextual filter, and specify validation criteria with PHP code pasted to UI of Views:

$path_arr = drupal_get_destination();
$path_str = $path_arr["destination"];
$path_explode = explode("/", $path_str);
$path_last = end($path_explode);

if( $path_last == "releases" ) {
 return true;
}

And after that the certain view would be shown in case of last part of path equal to releases. Now some ENTITY CONTENT SETTINGS to cover only selected content type.

If function arg would accept -1 this could be done as fast as

if(arg(-1)=="releses") { ... }.

How about performance of such a solution? Is it much slowing down the whole thing?

3 Answers 3

0

In the Page settings section of the view editing form, there is an item labeled Path. Click on this item. It allows you to enter the path under which the view will be accessible.

1
  • 1
    Thanks for the answer. That would be fine if I wanted to make separate page with fixed position in menu. But content type "Software Project" which I am dealing with, might appear in few places of the menu hierarchy. It might be: - Dept A / Users / Software / Project X / Releases but also - Dept B / Computings / Framework / Releases So I would like to add certain View everytime when drupal is showing node of this content type with additional "releases" in path.
    – wtk
    Commented Nov 29, 2011 at 11:19
0

Here are two ideas that might help:

If you expose your view as a block, you can specify in the block settings for it to only appear on nodes of a certain content type.

or

You can specify wildcards in your path settings for a Page view. For instance, you can set a page to display on %/%/%/%/releases.

You can configure arguments that correspond to those % under the arguments section which can affect what appears in your view, or you can add them all as placeholders.

0

I ended up with using ?subpage in the end of URL. I'm intercepting ?word using:

$q = drupal_get_destination(); 
$q = $q["destination"];
$delimiter = '/\?([a-zA-Z\-]+)=$/';
preg_match($delimiter, $q, $matches);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.