Adding another navigation bar (View Edit Outline Revisions Track) At the bottom of Nodes

paragon77 - October 11, 2009 - 01:38

Some of the content we are publishing can get long. It is collborative, so I am looking to add a duplicate of the navigation bar to the bottom of certain content. How can I do this and can I restrict it to certain content type?

Thanks in advance

Just checking in to see if

paragon77 - October 12, 2009 - 23:57

Just checking in to see if anyone has had a chance to review this question.

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

Still checking in to see if

paragon77 - November 1, 2009 - 15:02

Still checking in to see if anyone can help me with this addition I would like to make.

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

Psuedo code

ludo1960 - November 1, 2009 - 15:13

In Page.tpl

if contenttype = "whatever"
print "mynavbar"

endif

Thanks for piping

paragon77 - November 7, 2009 - 03:59

Thanks for piping in!

Unfortunately I am no drupal wiz. Are you saying to edit the page.tpl.php file and add that?

Could you give me a greater detailed explanation of what to do? I run two themes on my site. One is garland and the other is the pixture_reloaded theme. I didn't see a reference to contenttype or mynavbar in the page.tpl.php file for either of those themes.

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

Hi

ludo1960 - November 7, 2009 - 09:20

Sorry for the brief answer, but I aint no whiz either. Here's what I would try: If your content type is say "mycontent" copy your node.tpl.php in your theme folder (don't delete the original node.tpl.php!) rename it node-mycontent.tpl.php. then edit this file.

Depending on your theme you will find a some code like:

<?php if ($links): ?>
      <div class="links">
        <?php print $links; ?>
      </div>
    <?php endif; ?>

Copy this code after the code for the content ie so it appears again after your content....Good luck!

Getting closer. I did what

paragon77 - November 13, 2009 - 00:47

Getting closer. I did what you said. It added a repeat of links that say:

Add new comment flag this Read more 28 reads <---of course that changes with the number of reads.

It didn't add another row of the buttons that give someone the options of

* View * Edit * Outline * Track

Those are what I am trying to add at the bottom of the content as well as have them at the top.

Any ideas?

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

Print..

ludo1960 - November 13, 2009 - 16:42

... the contents of your page.tpl here, maybe there is an easy answer to your problem.

Here is the copy of my

paragon77 - November 14, 2009 - 01:21

Here is the copy of my page.tpl.php

<?php // $Id: page.tpl.php,v 1.17 2009/05/07 17:00:40 jmburnz Exp $
/**
* @file
*  page.tpl.php
*
* Theme implementation to display a single Drupal page.
*
* @see template_preprocess()
* @see template_preprocess_page()
*/
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language->language; ?>" xml:lang="<?php print $language->language; ?>">
<head>
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <?php print $head; ?>
  <title><?php print $head_title; ?></title>
  <?php print $styles; ?>
  <!--[if IE]>
    <link type="text/css" rel="stylesheet" media="all" href="<?php print $base_path . $directory; ?>/ie.css" >
  <![endif]-->
  <?php print $scripts; ?>
</head>
<?php
  $pixture_width
= theme_get_setting('pixture_width');
 
$pixture_width = pixture_validate_page_width($pixture_width);
?>

<body id="pixture-reloaded" class="<?php print $body_classes; ?> <?php print $logo ? 'with-logo' : 'no-logo' ; ?>">

  <div id="skip-to-content">
    <a href="#main-content"><?php print t('Skip to main content'); ?></a>
  </div>

    <div id="page" style="width: <?php print $pixture_width; ?>;">

      <div id="header">

        <?php if ($site_logo): ?>
          <div id="logo"><?php print $site_logo; ?></div>
        <?php endif; ?>

        <div id="head-elements">

          <?php if ($search_box): ?>
            <div id="search-box">
              <?php print $search_box; ?>
            </div> <!-- /#search-box -->
          <?php endif; ?>

          <div id="branding">
            <?php if ($site_name): ?>
              <?php if ($title): ?>
                <div id="site-name"><strong><?php print $site_name; ?></strong></div>
              <?php else: /* Use h1 when the content title is empty */ ?>
                <h1 id="site-name"><?php print $site_name; ?></h1>
              <?php endif; ?>
            <?php endif; ?>
           
            <?php if ($site_slogan): ?>
              <div id="site-slogan"><em><?php print $site_slogan; ?></em></div>
            <?php endif; ?>
          </div> <!-- /#branding -->

        </div> <!-- /#head-elements -->

        <?php if ($primary_menu || $superfish): ?>
          <!-- Primary || Superfish -->
          <div id="<?php print $primary_menu ? 'primary' : 'superfish' ; ?>">
            <div id="<?php print $primary_menu ? 'primary' : 'superfish' ; ?>-inner">
              <?php if ($primary_menu): ?>
                <?php print $primary_menu; ?>
              <?php elseif ($superfish): ?>
                <?php print $superfish; ?>
              <?php endif; ?>
            </div> <!-- /inner -->
          </div> <!-- /primary || superfish -->
        <?php endif; ?>

    </div> <!--/#header -->

    <?php if ($header): ?>
      <div id="header-blocks" class="region region-header">
        <?php print $header; ?>
      </div> <!-- /#header-blocks -->
    <?php endif; ?>

    <div id="main" class="clear-block <?php print $header ? 'with-header-blocks' : 'no-header-blocks' ; ?>">

      <div id="content"><div id="content-inner">

        <?php if ($mission): ?>
          <div id="mission"><?php print $mission; ?></div>
        <?php endif; ?>

        <?php if ($content_top): ?>
          <div id="content-top" class="region region-content_top">
            <?php print $content_top; ?>
          </div> <!-- /#content-top -->
        <?php endif; ?>

        <div id="content-header" class="clearfix">
          <?php if ($breadcrumb): print $breadcrumb; endif; ?>
          <a name="main-content" id="main-content"></a>
          <?php if ($title): ?><h1 class="title"><?php print $title; ?></h1><?php endif; ?>
          <?php if ($tabs): ?><div class="tabs"><?php print $tabs; ?></div><?php endif; ?>
          <?php if ($messages): print $messages; endif; ?>
          <?php if ($help): print $help; endif; ?>
        </div> <!-- /#content-header -->

        <div id="content-area">
          <?php print $content; ?>
        </div>

        <?php if ($content_bottom): ?>
          <div id="content-bottom" class="region region-content_bottom">
            <?php print $content_bottom; ?>
          </div> <!-- /#content-bottom -->
        <?php endif; ?>

        <?php if ($feed_icons): ?>
          <div class="feed-icons"><?php print $feed_icons; ?></div>
        <?php endif; ?>

      </div></div> <!-- /#content-inner, /#content -->

      <?php if ($left): ?>
        <div id="sidebar-left" class="region region-left">
          <?php print $left; ?>
        </div> <!-- /#sidebar-left -->
      <?php endif; ?>

      <?php if ($right): ?>
        <div id="sidebar-right" class="region region-right">
          <?php print $right; ?>
        </div> <!-- /#sidebar-right -->
      <?php endif; ?>

    </div> <!-- #main -->

    <div id="footer" class="region region-footer">
      <?php if ($footer): print $footer; endif; ?>
        <div id="footer-message">
          <?php print $footer_message; ?>
        </div> <!-- /#footer-message -->
    </div> <!-- /#footer -->

  </div> <!--/#page -->

  <?php if ($closure_region): ?>
    <div id="closure-blocks" class="region region-closure">
      <?php print $closure_region; ?>
    </div>
  <?php endif; ?>

  <?php print $closure; ?>

<?php print theme('primary_links'); ?>

</body>
</html>

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

OK

ludo1960 - November 14, 2009 - 09:24

I think the line you want to repeat after the content section is:

<?php if ($tabs): ?><div class="tabs"><?php print $tabs; ?></div><?php endif; ?>

Good luck!

So to re-iterate, I need to

paragon77 - November 14, 2009 - 20:09

So to re-iterate, I need to create a file called node-book.tpl.php and copy the contents of node.tpl.php into that new file. I then add the section you just referenced and that should add another row of those buttons to the bottom of any content who's type is called "book"?

Here is what my node-book.tpl.php file looks like:

<?php // $Id: node.tpl.php,v 1.5 2009/05/04 20:52:54 jmburnz Exp $
/**
* @file
*  node.tpl.php
*
* Theme implementation to display a node.
*
* @see template_preprocess()
* @see template_preprocess_node()
*/
?>

<div id="node-<?php print $node->nid; ?>" class="node <?php print $node_classes; ?>">
  <div class="node-inner-0"><div class="node-inner-1">
    <div class="node-inner-2"><div class="node-inner-3">

      <?php if ($page == 0): ?>
        <h2 class="title"><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
      <?php endif; ?>

      <?php if ($unpublished): ?>
        <div class="unpublished"><?php print t('Unpublished'); ?></div>
      <?php endif; ?>

      <?php print $picture; ?>

      <?php if (!empty($submitted)): ?>
        <div class="submitted"><?php print $submitted; ?></div>
      <?php endif; ?>

      <?php if ($terms): ?>
        <div class="taxonomy"><?php print t('Posted in ') . $terms; ?></div>
      <?php endif; ?>
     
      <div class="content clearfix">
        <?php print $content; ?>
      </div>

        <?php if ($links): ?>
        <div class="actions clearfix"><?php print $links; ?></div>
      <?php endif; ?>
 
      </div></div>
  </div></div>
</div> <!-- /node -->

Adding
<?php if ($tabs): ?><div class="tabs"><?php print $tabs; ?></div><?php endif; ?>
after the content does nothing, however.

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

The navigation bar is the bar

AndyF - November 14, 2009 - 22:02

The navigation bar is the bar that (usually) goes down the right hand side of the screen. Maybe you want to repeat the primary links or something? I think the bit to repeat would be

<?php if ($primary_menu || $superfish): ?>
  <!-- Primary || Superfish -->
  <div id="<?php print $primary_menu ? 'primary' : 'superfish' ; ?>">
    <div id="<?php print $primary_menu ? 'primary' : 'superfish' ; ?>-inner">
      <?php if ($primary_menu): ?>
        <?php print $primary_menu; ?>
      <?php elseif ($superfish): ?>
        <?php print $superfish; ?>
      <?php endif; ?>
    </div> <!-- /inner -->
  </div> <!-- /primary || superfish -->
<?php endif; ?>

But it depends exactly what bar wants repeating

What I am trying to add is

paragon77 - November 14, 2009 - 22:32

What I am trying to add is another row of buttons like the ones circled in red in the attached screentshot link:

http://rpg-fusion.com/files/images/screenshot.png

Those buttons appear at the top of any node that can be edited and such.

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

Sorry, you did say that...

AndyF - November 14, 2009 - 22:42

Sorry, you did say that... then I'd agree with ludo1960... in fact I just tried it and it worked on mine... can you post your modified page.tpl.php with the extra print $tabs?

Ahhh...that did it. I've been

paragon77 - November 14, 2009 - 22:52

Ahhh...that did it. I've been working off the instructions where he said to create a copy of the node.tpl.php file named node-book.tpl.php and not the page.tpl.php file.

Editing the page file did it.

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

Cool. Also, unless you always

AndyF - November 14, 2009 - 23:04

Cool. Also, unless you always want duplicate tabs, don't forget what ludo1960 first wrote about checking content type.

I would love to only have

paragon77 - November 14, 2009 - 23:56

I would love to only have them show on the content types I choose, but I couldn't get it to appear on any of the nodes until I added it to the page.tpl.php file. We use a content type called a book at my site. So I created the node-book.tpl.php file but used the node.tpl.php file as the code. Should I create the node-book.tpl.php file and use the page.tpl.php file code to populate it before adding the snippet for the "bar" I want?

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

Oh Man..

ludo1960 - November 15, 2009 - 00:13

........... I was just trying to help the OP out. Did it do the trick?

I was the OP and I see where

paragon77 - November 15, 2009 - 13:48

I was the OP and I see where I created some confusion when I used the term navigation bar in my OP. I should NOT have used that at all. It is the tabs to View, Edit, Delete, Track, etc. that I am trying to recreate.

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

You do not want to populate

AndyF - November 15, 2009 - 02:11

You do not want to populate node-book.tpl.php with the contents of page.tpl.php. node-book.tpl.php is a specialisation of node.tpl.php. Both of them are responsible for formatting (only) nodes. The first one is used only on content type book, and the second one is used for all other types. The tabs are not considered part of the node, so they're not handled in either of those two files. The tabs are considered part of the page, so that's why the changes should go in page.tpl.php.

None of this solves your problem, and I don't know the best way to do it I'm afraid. If it was me, I'd extract the nid from the path, load the node, and check the node type. As I say, I don't know if this is the best way tho.

Try..

ludo1960 - November 15, 2009 - 13:01

<?php
if ($type == ''yourcontenttypehere") {
    print $tabs  ;
}
?>

Would I put that in the

paragon77 - November 15, 2009 - 13:37

Would I put that in the page.tpl.php file or the node.tpl.php file?

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

in the ..

ludo1960 - November 15, 2009 - 13:46

page.tpl good luck!

Adding <?phpif ($type ==

paragon77 - November 15, 2009 - 14:05

Adding

<?php
if ($type == ''book") {
    print $tabs  ;
}
?>

to the page.tpl.php file after the content section blanks the page when it loads. So I am guessing there is more that need be done then just that.

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

Hmm

ludo1960 - November 15, 2009 - 14:15

Not sure why this should be. Check for typos and maybe try single quotes round 'book'

OK good news is that there

paragon77 - November 15, 2009 - 14:44

OK good news is that there was a typo in your code causing the white screen. There were 2 single quotes before mycontenttype and the doublequote after. Fixing that solved the whitescreening.

Adding that, however, does not place the tabs at the end of the content.

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

try

ludo1960 - November 15, 2009 - 14:53

moving the code further down the page.tpl maybe you missed the ending of the content section, it can be confusing! Oh, and you sure you're viewing a content type "book" use the devel module to confirm this.

Yes I am viewing a "book"

paragon77 - November 15, 2009 - 15:11

Yes I am viewing a "book" after modifying the page file. Here is the snippet where the code you posted is located in the page file:

<div id="content-area">
          <?php print $content; ?>
        </div>

<?php
if ($type == "book") {
    print
$tabs  ;
}
?>


        <?php if ($content_bottom): ?>
          <div id="content-bottom" class="region region-content_bottom">
            <?php print $content_bottom; ?>
          </div> <!-- /#content-bottom -->
        <?php endif; ?>

I have it between the content-area and the content_bottom.

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

Instead of..

ludo1960 - November 15, 2009 - 15:23

print $tabs

try:

<div class="tabs"> print $tabs; </div>

White screens after replacing

paragon77 - November 15, 2009 - 15:28

White screens after replacing with this.

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

Maybe

ludo1960 - November 15, 2009 - 15:32

you have to use escape characters as the code is within a php statement, not sure exactly how to do this.

Wel,l you have me. I can see

paragon77 - November 15, 2009 - 17:00

Wel,l you have me. I can see why tabs are being added to every page since the $tabs is in the page.tpl.php file. Just need to learn how to have the extra row of tabs on the bottom only show on the content types I choose.

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

This works for me: <?php if

AndyF - November 16, 2009 - 03:30

This works for me:

<?php if ($tabs && isset($node) && $node->type=='CONTENT_TYPE_GOES_HERE'): ?>
  <div class="tabs"><?php print $tabs; ?></div>
<?php endif; ?>

Yup...that seemed to do it.

paragon77 - November 16, 2009 - 03:54

Yup...that seemed to do it. The tabs now show only at the end of the book content!!!

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

I run 2 different themes on

paragon77 - November 16, 2009 - 23:26

I run 2 different themes on my site. The code you provided works brilliantly for the pixture_reloaded theme. In the Garland theme, however, the snippet places the tabs in a column and they just appear as hyperlinks like this:

*View
*Edit
*Outline
*Track

Here is the code for the Garland where I added your code. Any ideas on how to get the actual tabs to show in in Garland in a row and not a column of links?

<div id="center"><div id="squeeze"><div class="right-corner"><div class="left-corner">
          <?php print $breadcrumb; ?>
          <?php if ($mission): print '<div id="mission">'. $mission .'</div>'; endif; ?>
          <?php if ($tabs): print '<div id="tabs-wrapper" class="clear-block">'; endif; ?>
          <?php if ($title): print '<h2'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .'</h2>'; endif; ?>
          <?php if ($tabs): print '<ul class="tabs primary">'. $tabs .'</ul></div>'; endif; ?>
          <?php if ($tabs2): print '<ul class="tabs secondary">'. $tabs2 .'</ul>'; endif; ?>
          <?php if ($show_messages && $messages): print $messages; endif; ?>
          <?php print $help; ?>
          <div class="clear-block">
            <?php print $content ?>
          </div>

<?php if ($tabs && isset($node) && $node->type=='book'): ?>
  <div class="tabs"><?php print $tabs; ?></div>
<?php endif; ?>

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

Just find the bit of code

AndyF - November 17, 2009 - 03:35

Just find the bit of code that currently prints tabs in Garland, put it between the if clause you're already using, and add it immediately after print $content. It's probably an idea to make a subtheme of Garland and override the page.tpl.php rather than directly editing.

I messed a little with doing

paragon77 - November 17, 2009 - 21:26

I messed a little with doing that, but caused either white-screening or no tabs. I apologize, in advance, for my lack of php and coding skills. Would you say that I should paste the following between the php if and php endif lines?

<?php if ($tabs): print '<ul class="tabs primary">'. $tabs .'</ul></div>'; endif; ?>
<?php if ($tabs2): print '<ul class="tabs secondary">'. $tabs2 .'</ul>'; endif; ?>

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

You have..

ludo1960 - November 17, 2009 - 21:30

a closing /div tag but no opening div tag, another typo you naughty boy!

yeah I caught that as well. I

paragon77 - November 17, 2009 - 22:12

yeah I caught that as well. I REALLY need to learn php. LOL

I have the tabs working the pixture_reloaded perfectly. It's the damned Garland theme where I can get the words for the tabs listed in a column at the bottom of the node, just not the actual row of tabs.

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

Thats not...

ludo1960 - November 17, 2009 - 22:29

..PHP..... it's HTML, so 2 things to learn ..LOL just add the starting div to your statemant in garland and job done!

Not sure which div tag should

paragon77 - November 17, 2009 - 22:50

Not sure which div tag should I use? I had tried putting just in front but that choked it. Well the upside of this is it's a learning experience. :)

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

Lol

ludo1960 - November 17, 2009 - 23:19

Ok, please read http://drupal.org/node/601220#comment-2273542 again, to repeat what he said ...don't muck about with core themes, cos it will come back and bite you in the bum!

This is untested code, just my guess (always bad, the drupal police are everywhere!)

<?php if ($tabs): print '<div ul class="tabs primary">'. $tabs .'</ul></div>'; endif; ?>

Probably won't work, but I bet it gets you thinking!

And here, I believe, is the

paragon77 - November 17, 2009 - 23:13

And here, I believe, is the code that works. Thanks for all of your help!!!

<?php if ($tabs && isset($node) && $node->type=='book'): ?>
  <div class="tabs"><?php if ($tabs): print '<ul class="tabs primary">'. $tabs .'</ul></div>'; endif; ?>
<?php endif; ?>

http://rpg-fusion.com
The nexus for roleplaying in the 21st century

That looks great!

AndyF - November 18, 2009 - 06:53

That looks great! Here's a few points.

  • The second if ($tabs) is unnecessary, because it's already checked in the line above.
  • The original garland source you posted doesn't seem to use a <div class="tabs">.
  • I'm not sure, but I understand that if you have floated elements (which is how the horizontal tabs list is made) you want to be using a <div class="clear-block"> wrapper to ensure the correct flow of rendering.

So with those small changes it'd be

<?php if ($tabs && isset($node) && $node->type=='book'): ?>
  <div class="clear-block">
    <ul class="tabs primary">
      <?php print $tabs; ?>
    </ul>
  </div>
<?php endif; ?>

(untested)

 
 

Drupal is a registered trademark of Dries Buytaert.