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
Comments
Comment #1
ronan commentedIf 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
hope this helps
R
Comment #2
scottrigbyThis works great ronan - thanks so much!
Comment #3
ronan commentedComment #4
planctus commentedDoes 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.
Comment #5
planctus commentedhow 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.
Comment #6
7immy commentedhi, 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
Comment #7
jphelan commentedI get an error when I use the code above. I'm using 5.12, do I need to change something?
Comment #8
stefan81 commentedDear 7immy,
Did you find a solution for version 6.x?
Comment #9
ronan commentedI don't see why that code wouldn't still work with the 6.x-1.x branch. Let me know if it isn't.
Comment #10
stefan81 commentedHi, I inserted the code you suggested above, but nothing happens.
I would be very useful to me if the title of the parent node can be called from page.tpl.php
Comment #11
ESBertrand commentedHere's a workable method to use for 6.x and later:
http://drupal.org/node/301262#comment-2502090
Erik
Comment #12
asb commentedHi,
I tried using the snippet from #1 in
custom-pager.tpl.php(from Custom Pager), and I'm getting the parent title - but it's not hyperlinked. If I'm putting the print statement inl(), I'm getting a link to the website root page (sorry, no coding experience).Is it possible to get a link on the parent title? That would allow to mimic the 'book' module's behaviour a bit more...
Thanks & greetings, -asb
Comment #13
isaac.niebeling commentedTry
Right now, you're not giving l (the link function) a path to go to, just a title -- more info on the function is at http://api.drupal.org/api/function/l/6
Comment #14
asb commentedThanks, Isaac,
indeed, this does work! ;)
Full
custom-pager.tpl.php, if someone needs it:That will result in a Custom Pager like
Thanks again & greetings,
-asb
Comment #15
asb commentedThe template from #14 seems to no longer work with 6.x-2.x-dev, or it doesn't work with secondary parents, or something else is broken, or it's just me ;-(
Comment #16
asb commented...and it's working again in 6.x-2.1, so I think this can be closed. Please reopen if issue still exists for you.
Comment #17
asb commented