Posted by ajakoan on July 19, 2011 at 9:42pm
2 followers
Jump to:
| Project: | Similar By Terms |
| Version: | 6.x-2.2 |
| Component: | User interface |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Hi,
This is a great module, and I think it can do what I want to do , but I can't figure it out.
I am making a classified ads page. It has two content types: wanted and offering.
When a user posts a new wanted ad I would like to immediately match it with possible offering ads, and vice-versa.
I dont' know how to do this in views, or even if its possible.
Logic:
If current node type == 'wanted', and it belongs to the logged in user, then show similar items from content type 'offering', except for those written by the logged in user.
.. and exactly the opposite for offering.
Thanks
Cheers
Aja
Comments
#1
This should absolutely be possible. You'll want to create two Views and render them as blocks. One will filter by node type == 'wanted' and the other will filter by node type == 'offering'. The trick is going to be to get the right blocks to show on the right nodes. For this I'd recommend either using the Context module, or doing some custom PHP in the block's configuration... This code is *untested*, but I think it'd be something like this:
<?phpif (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
if ($node->type == 'wanted') {
return TRUE;
}
}
?>
This will only show the block on the 'wanted' nodes.
Of course, if you use the Context module, you wouldn't have to deal with all that messy PHP in the interface... however you'd have to figure out Context (if you're not already familiar with it). :-)
Good luck!