I've got a problem with getting inserted views honoring the nodes per page setting that I designated. For example, I have ten random facts saved as individual nodes marked by a taxonomy term of "random facts." I'll create a view for them named randomFacts, with 1 node per page, and set the sort to random so there should be a random rotation of these ten facts.
If I provide a page view and give it a URL, it all looks correct. When I try to insert the view by adding [view:randomFacts] on a Page node, it shows all ten of the random facts in random order instead of just the first returned result.
Providing the view as a block type also appears to fix this problem. It seems to only affect when the view is arbitrarily inserted with the insert view string.
Anyone else run into this issue too? It doesn't seem to matter if I set the sort to random or by some other criteria. The inserted view refuses to honor the nodes per page setting regardless of if I set it to 1, 5, or 10.
Comments
Comment #1
mlsamuelson commentedTry constructing your insert tag like this: [view:randomFacts=1]
FYI, for reference, here's the syntax from the README.txt:
I anticipate that will resolve your issue.
mlsamuelson
Comment #2
taqwa commentedI"m having the same problem you mentioned above. Using the [view:myview=1] syntax isn't useful for me because I want the pager functionality.
Comment #3
Anonymous (not verified) commentedSee also
http://drupal.org/node/148400
I offer a thoughts on a solution but have no idea if its practical or would work
Comment #4
taqwa commentedI still haven't really figured out what the arguments feature does.
Do any of you know of another way I can insert a page view into the body (one that doesn't involve this module)?
Comment #5
taqwa commentedOk, I found a work around. Use this php code:
Change "view name" to the name of the view you want to insert. In vews_build_view, leave the number '2', but change '10' to be the number of nodes you want on each page.
Comment #6
hyperlinkedLukas, the arguments allows you to pass variables embedded in the URL string to the views module. It might be easiest to understand in the context of a calendar. You may have a calendar page set-up with views and if the URL is something like:
http://mydrupalsite.com/calendar/2007/08/03
argument 0 is calendar
argument 1 is 2007
argument 2 is 08
argument 3 is 03
You could pass argument 1,2, and 3 to the view to produce just a view of stuff happening on August 3rd, 2007.
Comment #7
OxideInteractive commentedWe've just ran into this issue too. A slight modification will respect the value for nodes per page you set in the view:
Comment #8
mlsamuelson commentedThis issue's gone a little off-track. The original user's problem seems to have been addressed (?), so I'm marking this as a duplicate of http://drupal.org/node/148400 (which I think nicely sums up the issue).
mlsamuelson
Comment #9
hyperlinkedI'd say that this issue is related to midkemia's issue, but I'm not sure if it's exactly the same. It's probably close enough and I have no objection to have this rolled in with midkemia's issue if it'll stand a better chance of getting resolved there.
The behavior that I was trying to take advantage of was present in Drupal 4.x and worked. It only partially works in Drupal 5.x. Settings for views that are defined from the Admin Area>Views are honored when a view is called as a block, but not if that view is inserted into a page. In Drupal 4.x, I could define the view and use "[view:MyGreatView5ItemsWithPager] and I'd get five nodes with a pager without having to call in any arguments with the insert view macro statement.