Hi,
I am having a slight disagreement with the views module, and I am hoping you can shed some light on how to best resolve this conflict.
First off I am using the Category Module (with Taxonomy Wrapper installed) to allow for users to create new 'Band' pages, as a category, so when a user creates a news article, they can select the Band as a category. That part itself works.
My problem is that on the band pages I would like a block to be created that outputs the last 5 articles related to that Band, using the views module to seperate the type of articles, therefore being able to have Last 5 blogs about Band, Last 5 news about Band, etc.
I come into a conflict, because I can't figure out how to use the arguments feature of views to read the urls and display the view.
My urls are like this for the band pages : example.com/bands/example-band
I use pathauto to place all new 'band' pages under bands/
Bands in this case is also the the container for the bands/categories.
Any clues how I can set up arguements to take the bands/example-band and display only those articles tagged with 'example band'?
Any help is really appreciated!
Thanks,
Jeremy
Comments
Quick answer:
Quick answer:
Try using the NodeID of each example-band (category module makes each container and category a node) as the argument filter.
Edit: Not sure about the pathauto part- I am also experimenting with it. If you find a solution, do share!
Unfortunately, it didn't
Unfortunately, it didn't work, so unless I can find a way to do it, I will have to drop the idea.
Okay, here is how to do it.
Okay, here is how to do it. Make sure you have blog entry enabled as a content type for your 'bands' container:
bands/your-example-band-name*in the text box and save the changes. The asterisk is so that your block will appear on *all* the pages under your example-band category.Visit www.yourdomain.com/bands/example-band and you should be able to see the block with the latest blog entries on the page of your example band. I have a working demonstration for you here
One funny thing I noticed is I couldn't see the block until I enabled access control for authenticated users in the basic information section of the block. This seems to be a bug in views module considering that I am uid1 and should be able to see everything.
Thanks, but still a few
Thanks, but still a few issues.
It worked fine as you had it, until I added a new post under a different band, and then that post showed up on the first example band's page; not good.
I know I can add a filter for the taxonomy term for bands: then is one of: example-band, but I don't want to have to create a new view per band, and placing each block.
Too bad their isn't a wildcard filter, where it can take the example-band argument and use it as taxonomy term for bands: is one of: (*), and then filter it based on that term. I realize the arguments feature helps to do that, but I can't find a way to get it to work with this and pathauto.
Thanks for your help,
Jeremy
I found a way to do it, and
I found a way to do it, and I would like to share it with you.
My problem with the arguements was it wasn't getting the right ones from the url that it needed to.
So using the views_build_view function, I changed that.
In the place I wanted the view to go, I simply put this.
And I had a view created called bandblog, that had an argument set to Term: ID, which will now output any entries that has a matching taxonomy term for the specified node.
Pretty cool, eh?
Thanks for your help Ramdak, I appreciate it!
Jeremy
You can also do this using
You can also do this using the php argument code section under the Arguments fieldset in a view. You can embed a tiny piece of context sensitive PHP code.
In this case, you'd probably want simply:
-- Merlin
[Point the finger: Assign Blame!]
[Read my writing: ehalseymiles.com]
[Read my Coding blog: Angry Donuts]
-- Merlin
[Read my writing: ehalseymiles.com]
[Read my Coding blog: Angry Donuts]
Glad I could be of some
Glad I could be of some help. Your post not only let me exercise my views muscles, but was interesting enough for merlinofchaos to actually step in and give some code. Now, that's going to be really useful:-)
Check if the first example band is the distant parent of the band under which you added the new post. Or, it can happen if you set the depth of the first example band (which is a category) to -1 or some such thing, although the other example bands would then have to be child categories of the first band, which doesn't seem to be the case here, so it is unusual.
I also noticed that although I set the order to be descending in the block, the order was mixed.