Community Documentation

PAC tree module snippet: Parent Node's ID, title, Brother nodes

Last updated October 6, 2006. Created by Squidgy on September 7, 2006.
Edited by pwolanin. Log in to edit this page.

PLEASE NOTE These snippets are user submitted. Use at your own risk.

Pretty simple and yet handy snippet for the PAC tree module - this assumes only one level of depth, which is quite naive of me, but it's all I needed for the current site. Anyone who wants to stretch it a bit, go nuts.

<?php

//Summons the Parent NID and Title
$parent_list = pacs_node($node->nid);
$parent = pacs_node($parent_list["pid"]);
print
$parent_list["pid"] . $parent["title"];
?>

Potential uses: On a child page, create a new 'brother' page under the parent node's id, at the same level as the current node.

<?php
$_SESSION
['pacs_new_node_pid'] = $parent_list["pid"];
print
'<a href="node/add/">New Brother Node</a>';
?>

About this page

Drupal version
Drupal 4.7.x

Reference

Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.
nobody click here