• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 523
  • Last Modified:

Drupal View Dependencies?

Here's the setup:

Drupal 7 and Views 3.

Articles may or may not have images associated with them.  On my home page, there is a block that has a leading article with image and then a list of articles next to it (all within a particular category).  See screenshot below.  

Since not all articles have images, I split this up between two views.  The one on the left with the image has a filter that ensures I have an article with an image.  It picks the single latest one. The view on the right is just a straight pull of the latest 7 articles.

There is a chance, of course, that one of the latest 7 articles has an image, in which case it'd be duplicated on the right.  I want to, in the right list-only view, exclude the node listed on the left.  I've been googling all morning, and have come up empty.  I've dabbled with Views PHP but it doesn't seem to be working.

Any ideas?

Screenshot
0
michaelgiaimo
Asked:
michaelgiaimo
  • 5
  • 5
1 Solution
 
dejaanbuCommented:
hi,

better you post this in  Drupal Zone. experts will come up with answers
0
 
michaelgiaimoAuthor Commented:
Sorry, didn't know there was a Drupal zone!  
0
 
HagayMandelCommented:
I guess this leads to your "correct" home page: http://www.haileywiseman.com/node

In admin/settings/site-information, goto the home page URL, and correct it accordingly
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
HagayMandelCommented:
Sorry, ignore. I was answering another questions :-)
0
 
michaelgiaimoAuthor Commented:
No ideas?
0
 
HagayMandelCommented:
As it seems, you're embedding 2 views in a page or using 2 blocks on a page..
I guess the easiest way to get this is create a difference between articles that have image(s), and one that don't.
You can add a field (has_image) to the article content type, and when an article has an image, this field will be checked. (you can even to it automatically by playing with preprocess in template.php.
Then, for the right block, you can filter the items to be last 7 items that don't have the has_image field checked.
0
 
michaelgiaimoAuthor Commented:
Thanks, but the problem with that is the ones on the right may have images and that's fine.

I'm filtering on whether an item has an image for the left block, using a 'not empty' file id.
0
 
HagayMandelCommented:
In that case you have to work systematically:
1. Build the left block as you do now.
2. Start building the right block with exactly the same query you use for the left block. (the only difference is that you don't display the actual node).
3. Get the node id, and use it to filter the list on the right block.
0
 
michaelgiaimoAuthor Commented:
I don't quite understand what you mean.  Can you elaborate?
0
 
HagayMandelCommented:
I'll try:

The first phase is to regularly generate the left block (with the image).
Then take this generated query, and use it for the initial stage of building the right block:
It will pull out the node id (nid) that is used on the left block.
Then  build the second query for the right block list, to be consisted of the last 7 articles, provided that the node id IS NOT the one pulled on the primal phase.
Example building the right block:
You run the query used for the left block, and it brings you the node id 1234.
Then you select the last 7 articles provided that their ids are different than 1234.
0
 
michaelgiaimoAuthor Commented:
Sort of vague.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now