Among other things, my site publishes a magazine. So, one of the content types on my site is magazine_article. These articles obviously belong to "issues" of the magazine. Consequently, every article gets a number (well, actually a string, but that shouldn't matter) through a CCK field called Issue.

I can make a View showing me all the articles belonging to, say, issue 123. The problem is, however, that there are about 300 issues, and I dread the idea of having to create 300 separate views. My target is to set up a node, consisting only of links to these 300 issues, as the "key to the archive", every link starting with, say http://www.mysite.com/?q=view_issue . But to make this work for every issue, I'd somehow have to feed the number of the issue to the View. I was hoping that I could use a View Argument to accomplish this. But Hooooowwww??? I have been doing a good deal of reading on this forum, but I just don't get the hang of this Arguments thing.

Could anyone give me a working example of how to make something like this?
What to put where???
Should there be "argument handling code"? How??

I'm really lost here, and I'd appreciate your help…

Ludo

Comments

zbricoleur’s picture

This helped me understand how arguments work with views: http://drupal.org/node/54455

znation’s picture

You're very close to the right solution with what you're doing with Views now.

You just need to make a single View, and make it take an argument... and then make that argument be the issue number. See: http://drupal.org/node/54455

Your resulting URL would be something like http://www.yoursite.com/issue/123 where 123 is the issue number. I assume that's what you want. It should be entirely possible with a single View set up.

znation’s picture

Ah, I got beaten to the link by whoever posted their comment while I was posting mine.

And, I forgot to answer your question about whether there should be argument handling code. No, you don't need that... Views will handle your arguments for you. You just tell your View which field your argument represents (in the Arguments section on the View setup), and it will magically only match that one. You'll probably want to use 404 Not Found (in the dropdown list) for how to handle non-existent arguments.

modul’s picture

Would you believe that after reading pages and pages on this Argument stuff, that I still had not grasped the ver basic fact that an argument represents a field? And would you believe that I was looking for a way to include "something" in the Views setup page, with some sort of "argument handling code", whereas the only thing to do was to simply say which field I wanted represented and then do the actual "argumenting" in a bunch of urls in a "table of contents" sort of node? Jeez... THANKS for using that word "represents", that was all I needed. Speaking of an eye-opener... :-)

Ludo

znation’s picture

Yes, I have to admit, the documentation for using Views is not very easy to understand... I had to get into it just by playing around with Views for a while and learning its behavior. I'm still not exactly a master, and I've since mostly ditched views for performance reasons. Views can be very powerful once you understand how it works, though. I'm glad you've got the argument thing working. Let me know if I can help with anything else.

thomie’s picture

Thank you so much, that was just the little bit of information I needed too to grasp those views arguments.

modul’s picture

Why is it that an explanation only makes sense after it has been explained to you? Now I understand some of the Arguments pages from the handbook. Thanks guys, for taking the time to clarify this matter to me! It works like a charm!

Ludo