When rewriting result values to make them appear as a link, you may need to access the current query string parameters (mostly the page one). For instance:

view/path/[nid]?page=%page

would be replaced to

view/path/16?page=1
CommentFileSizeAuthor
#3 views-1442960-3.patch1.49 KBplach
#1 views-1442960-1.patch1.46 KBplach

Comments

plach’s picture

Status: Active » Needs review
StatusFileSize
new1.46 KB

The attached patch implements the behavior described in the OP and clears the query string when no matching token replacement values are found, for instance:

view/path/[nid]?page=%page

is replaced to

view/path/16

if the page query string parameter is empty.

tim.plunkett’s picture

Status: Needs review » Needs work

I think we should avoid using single letter variables.
That said, this seems like an worthwhile patch.

plach’s picture

Status: Needs work » Needs review
StatusFileSize
new1.49 KB

I think we should avoid using single letter variables.

Agreed, we cannot use $value here, since it is already defined.

Status: Needs review » Needs work

The last submitted patch, views-1442960-3.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review

#3: views-1442960-3.patch queued for re-testing.

plach’s picture

@tim.plunkett:

Any other concern?

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

Nope.

plach’s picture

:)

dawehner’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Cool, that's a nice feature! Just committed the patch to 7.x-3.x. Thansk!

mxt’s picture

Hi all,

I've setted up a view with an exposed filter to select the mime type of a file field (i'm using the media module).

The exposed filter select option works very well and shows the following options:

  • - any -
  • audio
  • image
  • video

Now I need that the "No results behavior" -> "Global: text area" of my view shows the following text in case of no results:

"No results for media of type %type"

Where %type would be the token replacement for the value of the "type" param in the querystring (/gallery?type=audio).

I've tried to apply the patch provided in #3 but I can't see any %type token in the replacement patterns area for "No results behavior" -> "Global: text area"

I'm missing something?

Thank you very much

chop’s picture

Status: Patch (to be ported) » Needs review

#3: views-1442960-3.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, views-1442960-3.patch, failed testing.

mxt’s picture

At the end, to resolve #10, I've found the following workaround (for D7):

1) Activate the php filter in your "No results behavior" -> "Global: text area"

2) Fill the textarea with the following code:

<?php
$view = views_get_current_view();
$type = $view->exposed_input['type'];
?>
<p>No results for media of type <strong><?php print $type; ?></strong>.</p>

Do you think there is a better way to reach the same result?

mustanggb’s picture

Issue summary: View changes
Status: Needs work » Closed (won't fix)
plach’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
Status: Closed (won't fix) » Fixed

This was actually fixed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.