Ok let me explain a little further

if i use

[view:myview]

I get the pager supplied by Views

If i use

[view:myview=50]

i get no pager just the view limited to 50 nodes

If i use

[view:myview=50=arg1]

i get my views limited to 50 nodes where argument 1 applies

If i substutute =50= for == or =0= i get all the nodes that apply to argument 1


What i want to do is have the views pager though when using arguments

so something like 

<code>[view:myview=((usepager)or(maxnode))=arg1]

a possible sollution might be if the number of pages were the last term so it was

[view:myview=arg1=pages]

leaving off the last term i am guessing would allow for the Views pager

So my question is how do i get to use the pager with arguments, has it been done and if so how

TIA

Comments

mlsamuelson’s picture

Component: Miscellaneous » Code
Category: support » feature

I've marked a few other pagers issues as duplicates and pointed them here, as I feel midkemia's examples give the best jumping off point for clarifying the issue.

Basically, what we need is to add a layer of logic so we can tailor our views_build_view() (see http://drupal.org/node/121202) to whether we're doing a simple limit or wanting to use the pager.

Additionally, we need to make sure there aren't any unforseen consequences of bringing pagers into nodes.

I've changed this issue to a feature request.

Duplicate issue references: http://drupal.org/node/162873 and http://drupal.org/node/121202

mlsamuelson

mlsamuelson’s picture

Another duplicate for reference: http://drupal.org/node/67258.

square_rinoa84’s picture

I've the same issue. Anybody knows how to fix this???

yngens’s picture

Same problem here. My inserted view lists only limited number and it is not possible to view extra pages. I do not understand much about how to use arguments, but trying this code:

<? [view:comments_all=3=use_pager=true] ?>

did not work. So as I understand Insert View module does not support use of pager at all for now? Or I am doing something wrong?

yngens’s picture

ok, after reading all the related threads i found a solution posted by Borek: http://drupal.org/node/121202. bkz mlsamuelson is trying to concentrate on this page, i would like to confirm here, that it worked for me. but i am confused with mlsamuelson's comment there:


Thanks, Borek! It's actually a little more complicated than this because of conflicts between the Insert View limits and how we're passing that info to views_build_views.

what is with and how much wrong the suggested by Borek method?

jpoesen’s picture

I confirm that the Borek fix (http://drupal.org/node/121202) works and have not yet experienced any side effects...

osopolar’s picture

I use Borek's fix too but only if there is no limit in the insert view tag.
(line 75)

if (is_numeric($limit)) {
          $replace = views_build_view('embed', $view, $view_args, FALSE, $limit);
 }
 else {
          $replace = views_build_view('embed', $view, $view_args, $view->use_pager, $view->nodes_per_page);
          // the original one was:  $replace = views_build_view('embed', $view, $view_args, FALSE, NULL);
 }
mlsamuelson’s picture

Status: Active » Needs review
StatusFileSize
new3.15 KB

I've attached a patch that allows a person to insert a pager view by setting a limit and replacing "view" in the tag with "view_pager".

So for example, to insert the tracker view so it'll only display 5 results per page, you could do [view_pager:tracker=5]

Please, test this and let me know if:

1. the patch works
2. the functionality works in your scenarios

mlsamuelson

john bickar’s picture

Patch fails for me against the 03/11/08 5.x-1.x-dev version.

patch < insert_view-148400.patch 
patching file README.txt
Hunk #1 succeeded at 21 with fuzz 1.
Hunk #2 FAILED at 40.
1 out of 2 hunks FAILED -- saving rejects to file README.txt.rej
patching file insert_view.module
Hunk #1 FAILED at 53.
Hunk #2 succeeded at 66 (offset -8 lines).
1 out of 2 hunks FAILED -- saving rejects to file insert_view.module.rej
mlsamuelson’s picture

StatusFileSize
new6.51 KB

I've re-rolled the patch.

john bickar’s picture

For me:

  • Patch applies cleanly
  • Functionality works as expected

Thanks!

mlsamuelson’s picture

Assigned: Unassigned » mlsamuelson
Status: Needs review » Reviewed & tested by the community

In light of #11, marking this as RTBTC...

I plan to commit the patch this evening, time permitting.

Thanks cubbtech!

mlsamuelson

mlsamuelson’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, cubbtech!

Committed.

(And now I've also created the initial 5-x-1.0 release.)

mlsamuelson

Anonymous’s picture

Before I upload the latest release I would just like to clarify the syntax?

views_pager:myview=pages=arg1,arg2,arg3

mlsamuelson’s picture

Close. No 's' on view. It should be:

[view_pager:myview=3=4,5,6]

(That would insert the view "myview" with a pager showing 3 results/nodes at a time, supplying the args 4, 5, and 6.)

And note, this is, of course, only for views you want to have a pager on. You can continue to use the classic non-pager style of Insert View tags.

More info is in the README.txt. Additionally it wouldn't hurt to read the upgrade info in there.

And lastly, if you install the new version and the filter cache is causing your views to be cached, simply go to the input filters admin page, click configure for the formats in question, make sure the Insert View filter is turned on, and then submit the form (even if you made no updates, as this will jog the input format's memory and it will clear the filter cache and no longer cache the views).

mlsamuelson

Anonymous’s picture

You spotted my normal mistake with InsertView for almost a year now I have first typed 'views' before going back and changing it to 'view' , maybe it seems natural to me

The reason i queried the use of the args is its not given as an example in the readme file, all that exists is

You can use a pager with your view by using the following syntax (note:
you must set a limit which will serve as the number of nodes per page):

[view_pager:<name of view>=<number>].

Maybe the addition of the following may help

[view_pager:<name of view>=<number>=<comma-delimited-list>] limits the listing to a
particular <number> of entries per page, uses the pager facility, and passes a comma delimited list of arguments to the view.

Here's an example you could use with the default view named "tracker" which
takes a user ID as an argument:

[view_pager:tracker=5=1]

In short this tag says, "Insert the view named tracker, limit the number of
results to 5 entries per page, use the pager facility, and supply the argument/user ID 1."
mlsamuelson’s picture

Category: feature » task
Status: Fixed » Active

In light of comment 16, I'm going to mark this as active and a task... I would like to make the README.txt as thorough as possible.

Thanks for the feedback, midkemia.

mlsamuelson

(Note to self: see #180042: insert view filter results should not be cached., for additional README.txt updates.)

Anonymous’s picture

First Installed 5.x-1.0 and the views_pager funtions perfectly.

Note: It took 2 installation attempts to get the filter to show up.

The following is an observation but as we have no category for that I taged it on here

There also seems to be a good side effect/issue from the updated module, though it is probably down to the changes you made to how it works.

Let me explain

I had been using the Alinks module, but it would not create links to cck fields that were contained in nodes, nor views, nor views inserted using Insert View.
Now after upgrading to 5.x-1.0 of Insert View, the Alinks module will link for nodes that form part of a view and inserted using insert views (but still doesn't to nodes or views)

I have mentioned this in case it is the sign it may not be functioning as expected.

mlsamuelson’s picture

Issue tags: +best issue ever

Interesting.

Haven't played around with the Alinks module, but what pops to mind is that this might be an effect from Insert View turning the filter format into a non-cacheable format - which it does now.

mlsamuelson

pasqualle’s picture

Status: Active » Closed (won't fix)

closing all D5 issues

pager works in D6 and D7 releases..