CLOSED
--
Hi,

I have (or will have) a bunch of nodes with CCK and nice content (coverage-location). I also have another bunch of nodes and nice content (coverage-type). Both of these types will not actually be published.

I would like a way to create a new url/page which combines these in all variations (coverage-result type used as a template). Preferably as I add one or the other, it will make the new pages. The idea is to have targeted pages.

I believe this is possible using views or could be done with a small module. I need help as I have no idea where to start - I would like either someone to literally do this for me or to be hand-held through it myself. Please quote for either.

Thanks,
Paul.
---
Example:

Job (coverage-type):
Chinese, Indian

Location (coverage-location):
London, New York, Paris

Which would create (using coverage-result as a template or newly created nodes):
/Chinese-Restaurants-in-London
/Chinese-Restaurants-in-New York
/Chinese-Restaurants-in-Paris
/Indian-Restaurants-in-London
/Indian-Restaurants-in-New York
/Indian-Restaurants-in-Paris

Comments

Drave Robber’s picture

Just my tuppence... Views itself primarily works to select content, not to combine it. There are of course different sorts of utility modules, but right now we're in a sort of 'gap year' – Views Union and Views Fusion are already dead, and #1101938: Views Unionize is not yet officially released.

Even if any of these was readily available for D6, there are certain setbacks to Views approach (well, of course, there are certain advantages, too). Views would create just an on-demand display, not a 'standing' piece of content (node or whatever); this means, for example, that you would not be able to have comments on your 'combined pages' (at least not easily).

On the other hand, writing a custom module that generates new nodes based on certain conditions is technically easy, but poorly scalable. Last week I found out that my cheap-ass shared hosting will already start to squeak when creating 15 node revisions (not even full nodes) at a time. So, if there are 100 nodes of type A and adding a new node of type B calls for automatically creating 100 nodes of type C, then it probably will need to divide the job over several cron runs using Batch API or something like that.

What is the the best way to about this probably depends on whether these 'combined pages' need to provide any other functionality than displaying a bit of this and a bit of that.

techypaul’s picture

Hi, thanks for the comments - after giving it some thought and reading your post, I think a module would be the best way forward for this. My hosting should be up to scratch, but batching it would prudent anyway.

Your assistance is much appreciated.

Thanks,
Paul.

Greg Varga’s picture

I believe this could be done in a very simple module.
Nodes could be generated on the fly or during cron run.
Maybe it is a good idea to use taxonomy for the coverage-type & coverage-location..

Contact me if you need help with this.

Cheers, Gergely

techypaul’s picture

Sent you an email.

WorldFallz’s picture

imo you're approaching this incorrectly-- and fighting the 'drupal way' is going to cause you more work. Usually this type of content relationship is done with with nodereferences. Once you've established the relationship, there's all sorts of ways to reformat the content as desired-- viewfield, eva, panels, nodereference_views, etc. There's also all kinds of nodereference enhancement modules to facilitate this method (nodereference_url, noderefence_field, nodereference_autocreate, etc.) Doing it this way requires 0 custom code.

of course I may be completely misunderstanding your use case, so feel free to ignore. ;-)

techypaul’s picture

Hi,

The way I am going to do this is:

1. Create a node type which will be my 'location' (always unpublished).
2. Create a node type which will be my 'type' (always unpublished).
3. Create a node type which will be my 'result' (to be automatically created).

3 is the main one, which will be what the user sees, but all it will contain is two cck nodereference fields, one pointing to the location node and one to the type node. The template for this will then just be standard views etc as you suggest.

The issue I have is that I would like to create that 3rd nodes automatically upon creating one of the others, a custom module needs to loop through and create nodes for each of the new combinations (with the title being taken from the titles of the 1/2 nodes). Ideally it would keep track of this so that it can update the titles if we change them (and also remove them if we delete one of them). Sounds simple to me, but I am not a PHP programmer :).

Ta,
Paul.

WorldFallz’s picture

You might be able to do this with the rules module without custom code-- just a thought.