Project:Sliced Book Navigation
Version:5.x-1.0
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Great module.... Having an issue however getting the title to display in the blocks in the "menu" display on the side. The center blocks are returning the title. I made the following adjustments and had some success:

Changed $block['subject'] = ""; to $block['subject'] = implode($title);

I added a function call to return $title:

function get_title() {
$path = slicedbook_navigation_get_active_id();
$result = db_query('SELECT n.title, n.nid FROM {node} n WHERE n.nid = '.$path.' AND n.status = 1');
  while ($node = db_fetch_object($result)) {
    $title[$node->nid] = $node->title;
  }

return $title;
}

And declared the variable on line 75; $title = get_title();

This works this way. When a top level menu item is accessed, it opens the "sliced" menu box and places the top level title in the "title" field of the new menu box while populating the rest of the menu. Oddly enough however, it only works for logged in users. Anonymous users see no title but do see the title of the individual "sub menu" items.

Also, even though it works, Drupal is prompting an error on the "implode" call as follows.
warning: implode() [function.implode]: Argument to implode must be an array. in /var/www/vre.upei.ca/htdocs/sites/vre.upei.ca.ui4/modules/slicedbook_navigation/slicedbook_navigation.module on line 90.
Removing the implode results in getting a display of "Array" in each title box as does echoing the $title variable without imploding it.

Comments

#1

Title:title empty» title empty - update

issues described adjusted.... new code as follows:
Function to get title variable:

function get_title() {
$path = slicedbook_navigation_get_active_id();
$result = db_query('SELECT title, nid FROM node WHERE nid = '.$path.' ');
  while ($node = db_fetch_object($result)) {
    $title = $node->title;
  }

return $title;
}

variable declaration:
$title = get_title();

title inserted into title of block:

$block['subject'] = $title;

This is working fine in our install but creates a new issue. When we enable a third "slice" of the menu, all the submenus have the same title. The variable is set at the "top" of the view portion of the module and would have the block['subject'] variable included in the functions that result in individual links being processed.

#2

Title:title empty - update» title empty - last update

To resolve remaining pathing issue, the function call (newly added) was changed to:

function get_title() {
$path = slicedbook_navigation_get_active_id();

if (($path == 'node') or ($path == 'add')) {
$path = '';
}
elseif ($path != ''){
$result = db_query('SELECT title, nid FROM {node} WHERE nid = '.$path.' ');
     while ($node = db_fetch_object($result)) {
     $title = $node->title;
     }
  return $title;
}
}

This resolved issues with clean urls for create content which placed a "add" in the path and for the root of the site which returned null. Titles now return as a header for each submenu list in the menu list.