The link tree is a valuable navigation tool while in the forums. While not in the forums, it's use is questionable?
Question: can I strip the linktree out - but keep it for use in the forums?
I've seen where the linktree() code is ... I'd just like to add an if statement at the beginning of the function to exit without doing anything unless the user is in the forums. Is there some magic global "in_forums" context variable to do an "if" on in the linktree() function?
If anyone thinks this is a really stupid idea - please feel free chime in - wouldn't be the first time.
I can't see a purpose for the linktree outside of the forums.
Regards -
==
Quote from: Bloc on November 04, 2005, 11:47:34 AM
Stripping out linktree..the easiest is to just remove everything between
function linktree();
{
...and
}
- leaving just a empty function. For even more control copy it first, and name it linktree2, then call link-tree2 exactly where you want it, and in just the templates you need it to be. I have done that in quite a few themes...
you can use this.
if (@$_REQUEST['action'] == 'forum')
echo' ', theme_linktree(), '';
it's saying to display the linktree if and only if the action "forum" is requested.
Thanks - that partially works.
Upon 1st entry into the forum (shot #1) the linktree is present.
However, as soon as anything in the forum is selected, the link tree goes away (shot #2).
I wasn't sure what file to add your suggestion to - so I added the "if" as the first line of code in the function linktree() in the file index.template.php (and of course - closed off the if with another bracket near the end of the file).
if (@$_REQUEST['action'] == 'forum') {Quote from: Tippmaster on November 06, 2005, 03:57:44 AM
you can use this.
if (@$_REQUEST['action'] == 'forum')
echo' ', theme_linktree(), '';
it's saying to display the linktree if and only if the action "forum" is requested.
ah, i see. i guess i didnt realize how tp works. i thought that action=forum would be called the whole time you are in the forum, but it isnt, like in topic views, or even while im posting this message...
hang on. ill come up with something for you today.
Just take out the linktree call from TPortal.template, TPortalAdmin.template and TPmodules.template and it will show only in forum... ;)
Excellent - thanks to all - only one edit in two files (it doesn't look like TPortalAdmin calls linktree).
Notes for the record (TinyPortal v.0.75):
I removed the call to "theme_linktree()" in files:
- TPortal.template.php
- TPmodules.template.php
hehe. I forgot the linktree is called in each template individually. I was thinking it was in index.template, which would make it display everywhere (without the if statement)
my bad. :D
Thank you. I was wanting to remove that code.
Yes, it would be nice to easily disable that feature as it throws off the center bar so that it does not line up properly. Maybe a checkbox in TP Admin?
I can add it as a option - I can see it not being desireable in all situations.
Quote from: Bloc on November 06, 2005, 06:12:05 PM
Just take out the linktree call from TPortal.template, TPortalAdmin.template and TPmodules.template and it will show only in forum... ;)
Am kinda new to all this... where is the linktree call in these files?
Search for "linktree" in the files and you get them all to show in the code :)
The linktree function is usually at the bottom of the index.template.php file.
Great stuff. Thanks for all your help! Woulda taken me forever to figure it out on my own.
Small problem, whenever I try to make changes to the template, it corrupts the whole page. I've tred deleting the "function theme linktree line" along with others. I know I'm doing something wrong... Bloc mentioned the TPortal, TPortalAdmin and TPmodules templates, but I couldn't find the "theme_linktree ()" in any of these... The site is here: "http://www.otownplays.com/smf/" (I'm running the DilberMC theme on TP0.9.5 and SMP 1.1RC3 if that makes a difference). Where do I remove the linktree stuff? Do I remove everything listed below, or just part of it? I don't know anything about php... I am working with a text editor to make my changes, is that the problem?
// Show a linktree. This is that thing that shows "My Community | General Category | General Discussion"..
function theme_linktree()
{
global $context, $settings, $options;
echo '<div class="nav" style="font-size: 85%; margin-bottom: 2ex; margin-top: 2ex;">';
// Each tree item has a URL and name. Some may have extra_before and extra_after.
foreach ($context['linktree'] as $link_num => $tree)
{
// Show something before the link?
if (isset($tree['extra_before']))
echo $tree['extra_before'];
// Show the link, including a URL if it should have one.
echo '<b>', $settings['linktree_link'] && isset($tree['url']) ? '<a href="' . $tree['url'] . '" class="nav">' . $tree['name'] . '</a>' : $tree['name'], '</b>';
// Show something after the link...?
if (isset($tree['extra_after']))
echo $tree['extra_after'];
// Don't show a separator for the last one.
if ($link_num != count($context['linktree']) - 1)
echo ' > ';
}
echo '</div>';
}
Thanks again...
Small update, I figured out how to remove the linktree from the template, but it removes it from the forum too. I'd just like to remove the linktree from the front page...
I have been looking at this too...
I can remove the whole linktree too but I just want the linktree to not show on first page
I do want linktree in forum and other areas
as well, linktree doesn't show in some mods like smf gallery, but it does in arcade... ( would the linktree code have to be put in the gallery.template.php to show??)
I know this is something simple....but.. ???
It's at the very beginning in TPortal.template.php.
just remove:
// show the linktree
if((isset($context['TPortal']['boardnews'][0]['options']['linktree']) && $context['TPortal']['front_type']!='frontblock') || $context['TPortal']['front_type']=='frontblock')
echo '
<div style="margin-bottom: 4px;">', theme_linktree() , '</div>';
perfect...thnx..thats exactly what was wanted... :up:
Quote from: Maya on October 22, 2006, 09:39:12 PMperfect...thnx..thats exactly what was wanted... :up:
No problem.
It also removes the margin / space from the text and the 4px margin underneath the text, though. :-\
I just noticed that...
maybe leaving in
echo '
<div style="margin-bottom: 4px;">', '</div>';
without the 'linktree' info would keep the 4px spacer there, just no info in it
*just tried it, works fine
Quote from: Maya on October 22, 2006, 09:52:02 PMI just noticed that...
maybe leaving in
echo '
<div style="margin-bottom: 4px;">', '</div>';
without the 'linktree' info would keep the 4px spacer there, just no info in it
*just tried it, works fine
Yep, that should do it. :up:
u pointed me in the right direction...thnx :up:
this thread got a bit confusing..lol
LOL
Actually, you'll want to raise the margin. The 4px looks no different than if you just cut the code out completely.
??? I just checked it...r u using ff..
it doesn't show any diff in ff, but it lined everything up perfectly in ei6...
soooo... now what to do?
It looks the same for me, in both FF and IE.
That is, when I replace the code with what you said, it simply cuts the space down - it removes the text and the 4px margin space underneath the text. It just leaves the space above the text.
And I was just saying that, if you have something above the front page items (articles, forum posts ...) and whatever is above them (and above the link tree), you'll want to raise the margin there to something bigger. If you don't have anything above there, then the spacing is probably of no concern. ;D
I think the confusion was that I had a center block above the front page items and the spacing was just cut out completely and it looked bad. :-\ :idiot2:
Thanks everyone! That solved my problems... ;D
Mike