How to show view of Parent title on the Children node?

scottrigby - February 22, 2008 - 20:42
Project:Node Hierarchy
Version:6.x-1.2
Component:User interface
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I have not figured out how to do this - I know the breadcrumb does this, but my interest is to print the title of the parent node in the body of the child node.

A view would be fine, and it seems like this may already be a feature (which is why I'm labeling this issue as a support request instead of a feature request) but please let me know if I'm wrong about that.

If this exists, how do it do it?

Thanks in advance!
Scott

#1

ronan - February 26, 2008 - 04:41

If you're comfortable with templates and a little php, what I do is use node_load to load the parent node within the template and display the title from that:

within the node-xxxx.tpl.php file

<?php
  $parent
= node_load( $node->parent );
  echo
$parent->title;
?>

hope this helps
R

#2

scottrigby - March 2, 2008 - 15:03

This works great ronan - thanks so much!

#3

ronan - March 6, 2008 - 20:58
Status:active» closed

#4

planctus - October 5, 2008 - 18:10

Does anybody know how to show the parent title in a children nodes view as the view title?
This is going me crazy, nodehierarchy is great but when i choose to build a view as a separate page using the parent node id as the view argument i'm not able to print the parent title as the view title, so i have childrens being shown but nobody sees which node they belong to.
I added the parent field in the children view, but it's not the same, i would like to have the parent title as the page title..
I've tried using php in view header to get the parent title and show it but it didn't work...
Thanks,
Da.

#5

planctus - October 5, 2008 - 18:31

how stupid am i?
that was easy...i had to use the %1 in the view title.
Thanks, i don't know it this happens to someone else...but when i write something like an issue here on drupal.org usually i find the solution by myself in a short time :-)
Don't know why...
Da.

#6

7immy - October 27, 2008 - 15:10
Version:5.x-1.x-dev» 6.x-1.0

hi, sorry to bring this post back up but i cant seem to get this to work. I've tried adding it to "node.tpl.php" but nothing shows up? dont know if this makes a difference but I'm using version 6 and the original poster is using version 5.

this is the closest I've come to in finding a way to add the parent title to a child page.

please help
thanks

#7

jphelan - November 20, 2008 - 17:32

I get an error when I use the code above. I'm using 5.12, do I need to change something?

#8

yanku - May 26, 2009 - 05:51
Version:6.x-1.0» 6.x-1.2
Priority:critical» normal
Status:closed» active

Dear 7immy,
Did you find a solution for version 6.x?

#9

ronan - May 27, 2009 - 01:49

I don't see why that code wouldn't still work with the 6.x-1.x branch. Let me know if it isn't.

#10

yanku - May 27, 2009 - 04:41

Hi, I inserted the code you suggested above, but nothing happens.


<?php
  $parent
= node_load( $node->parent );
  echo
$parent->title;
?>

 
 

Drupal is a registered trademark of Dries Buytaert.