In some websites I need to set the first child as the main page in a section. Imagine 'Products' and when I click on it, I want to show the first product, and a list with the rest. I don´t want to have an introduction for products, and a list with the children.

Is there any way to get this? Maybe redirecting?

CommentFileSizeAuthor
#2 nodehierarchy.patch9.38 KBmeecect

Comments

meecect’s picture

+subscribe

meecect’s picture

StatusFileSize
new9.38 KB

I ended up writing a patch for this. I added a db column, called placeholder, that will let you define (through the regular node edit form) which nodes should be considered placeholders. A placeholder node will automatically redirect to the first child node.

My patch also includes some stuff to allow customization of menu item creation, detailed at http://drupal.org/node/375106 .

Test it out and let me know if you have any issues.

heliotrope’s picture

Hi,

this is a very handy feature.
do you plan to review this patch to get it working with the 6.2 dev version ?

:)

meecect’s picture

@heliotrope

if that was directed at me, then yes, I will probably try to get it working on the 2.x dev version, although, I think 2.x has done away with the nodehierarchy table entirely and is just using the core menu module, so I will have to take a slightly different approach.

heliotrope’s picture

@meecect

I've got it working with the 6.2 branch but in a very nasty way :(
I'm now using the ['options']['attributes'] to save the placeholder value.

I'm a newbie in drupal development.
I'll try to improve the code and will post a patch if I can.

:)

luksak’s picture

hi everyone

i am also very interested in this. the redirection works with your patch, but the automatic menu creation seems to be broken.

what's your experience?

best regards

lukas

jon betts’s picture

I'm very interested in this too. There is another module called Menu Firstchild that does this, but it seems incompatible with Node Hierarchy. Is there another way to provide this type of functionality?

luksak’s picture

I ended up using the core menu module. I have to manually set the child path in the parent.

jbylsma’s picture

Component: Code » Drupal/PHP Code
Status: Active » Fixed

I've used cck_redirection for items that needed to redirect, and it worked pretty well.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.