TinyPortal

Development => Feedback => Topic started by: iowamf on November 06, 2005, 12:21:11 AM

Title: stripping out the linktree - except while in the forums
Post by: iowamf on November 06, 2005, 12:21:11 AM
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...
Title: Re: stripping out the linktree - except while in the forums
Post by: 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.
Title: Re: stripping out the linktree - except while in the forums
Post by: iowamf on November 06, 2005, 01:59:02 PM
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.
Title: Re: stripping out the linktree - except while in the forums
Post by: Tippmaster on November 06, 2005, 02:17:57 PM
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.
Title: Re: stripping out the linktree - except while in the forums
Post by: 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... ;)
Title: Re: stripping out the linktree - except while in the forums
Post by: iowamf on November 06, 2005, 07:28:46 PM
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:




Title: Re: stripping out the linktree - except while in the forums
Post by: Tippmaster on November 06, 2005, 07:31:05 PM
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
Title: Re: stripping out the linktree - except while in the forums
Post by: houston on November 15, 2005, 05:51:06 PM
Thank you. I was wanting to remove that code.
Title: Re: stripping out the linktree - except while in the forums
Post by: Rocket on November 16, 2005, 02:29:09 AM
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? 
Title: Re: stripping out the linktree - except while in the forums
Post by: bloc on November 16, 2005, 03:22:32 PM
I can add it as a option - I can see it not being desireable in all situations.
Title: Re: stripping out the linktree - except while in the forums
Post by: rkmike on October 16, 2006, 06:13:45 AM
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?
Title: Re: stripping out the linktree - except while in the forums
Post by: G6Cad on October 16, 2006, 06:26:53 AM
Search for "linktree" in the files and you get them all to show in the code :)
Title: Re: stripping out the linktree - except while in the forums
Post by: IchBin on October 16, 2006, 06:15:16 PM
The linktree function is usually at the bottom of the index.template.php file.
Title: Re: stripping out the linktree - except while in the forums
Post by: rkmike on October 21, 2006, 04:23:02 AM
Great stuff.  Thanks for all your help! Woulda taken me forever to figure it out on my own.
Title: Re: stripping out the linktree - except while in the forums
Post by: rkmike on October 22, 2006, 07:41:33 AM
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 '&nbsp;>&nbsp;';
   }

   echo '</div>';
}


Thanks again...
Title: Re: stripping out the linktree - except while in the forums
Post by: rkmike on October 22, 2006, 06:58:53 PM
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...
Title: Re: stripping out the linktree - except while in the forums
Post by: Maya on October 22, 2006, 07:48:23 PM
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.. ???









Title: Re: stripping out the linktree - except while in the forums
Post by: anunlike on October 22, 2006, 09:12:32 PM
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>';
Title: Re: stripping out the linktree - except while in the forums
Post by: Maya on October 22, 2006, 09:39:12 PM
perfect...thnx..thats exactly what was wanted... :up:
Title: Re: stripping out the linktree - except while in the forums
Post by: anunlike on October 22, 2006, 09:47:42 PM
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. :-\
Title: Re: stripping out the linktree - except while in the forums
Post by: Maya on October 22, 2006, 09:52:02 PM
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
Title: Re: stripping out the linktree - except while in the forums
Post by: anunlike on October 22, 2006, 09:59:09 PM
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:
Title: Re: stripping out the linktree - except while in the forums
Post by: Maya on October 22, 2006, 10:04:41 PM
u pointed me in the right direction...thnx  :up:

this thread got a bit confusing..lol
Title: Re: stripping out the linktree - except while in the forums
Post by: anunlike on October 22, 2006, 10:19:17 PM
LOL

Actually, you'll want to raise the margin. The 4px looks no different than if you just cut the code out completely.
Title: Re: stripping out the linktree - except while in the forums
Post by: Maya on October 22, 2006, 10:23:14 PM
 ??? 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?
Title: Re: stripping out the linktree - except while in the forums
Post by: anunlike on October 22, 2006, 11:53:57 PM
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:
Title: Re: stripping out the linktree - except while in the forums
Post by: rkmike on October 23, 2006, 01:54:18 AM
Thanks everyone! That solved my problems...  ;D

Mike