By paragon77 on
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
Comments
Just checking in to see if
Just checking in to see if anyone has had a chance to review this question.
Still checking in to see if
Still checking in to see if anyone can help me with this addition I would like to make.
Psuedo code
In Page.tpl
if contenttype = "whatever"print "mynavbar"
endif
Thanks for piping
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.
Hi
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:
Copy this code after the code for the content ie so it appears again after your content....Good luck!
Getting closer. I did what
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?
Print..
... the contents of your page.tpl here, maybe there is an easy answer to your problem.
Here is the copy of my
Here is the copy of my page.tpl.php
OK
I think the line you want to repeat after the content section is:
Good luck!
So to re-iterate, I need to
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:
Adding
<?php if ($tabs): ?><div class="tabs"><?php print $tabs; ?></div><?php endif; ?>after the content does nothing, however.
The navigation bar is the bar
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
But it depends exactly what bar wants repeating
What I am trying to add is
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.
Sorry, you did say that...
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
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.
Cool. Also, unless you always
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
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?
Oh Man..
........... I was just trying to help the OP out. Did it do the trick?
I was the OP and I see where
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.
You do not want to populate
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..
Would I put that in the
Would I put that in the page.tpl.php file or the node.tpl.php file?
in the ..
page.tpl good luck!
Adding <?phpif ($type ==
Adding
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.
Hmm
Not sure why this should be. Check for typos and maybe try single quotes round 'book'
OK good news is that there
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.
try
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"
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:
I have it between the content-area and the content_bottom.
Instead of..
print $tabs
try:
White screens after replacing
White screens after replacing with this.
Maybe
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
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.
This works for me: <?php if
This works for me:
Yup...that seemed to do it.
Yup...that seemed to do it. The tabs now show only at the end of the book content!!!
I run 2 different themes on
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?
Just find the bit of code
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
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?
You have..
a closing /div tag but no opening div tag, another typo you naughty boy!
yeah I caught that as well. I
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.
Thats not...
..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
Not sure which div tag should I use? I had tried putting just
Lol
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!)
Probably won't work, but I bet it gets you thinking!
And here, I believe, is the
And here, I believe, is the code that works. Thanks for all of your help!!!
That looks great!
That looks great! Here's a few points.
if ($tabs)is unnecessary, because it's already checked in the line above.<div class="tabs">.<div class="clear-block">wrapper to ensure the correct flow of rendering.So with those small changes it'd be
(untested)