News:

Wondering if this will always be free?  See why free is better.

Main Menu

Link Tree

Started by 1MileCrash, June 20, 2005, 07:10:41 PM

Previous topic - Next topic

1MileCrash

Is there a way i can totally wipe out the link tree from a given template?
The only thing php can't do is tell you how much milk is left in the fridge.



dtm.exe

Do you mean like making the link tree into something like SMF has?

QuoteSimple Machines Community Forum  |  SMF Development  |  Graphics and Templates (Moderators: ªcF, A.M.A, Tomer)  |  Topic: Link Tree

-Dan The Man

1MileCrash

no. Totally wipe it out. No link tree, no like that in any way. Just the nav bar.

Might as well not make a new thread, but how can i get text on the link tree the same size as the links to each forum.  (my prefered alternative)*
The only thing php can't do is tell you how much milk is left in the fridge.



bloc

Linktree is called a lot of places..and are really useful.. ;)

but if you need to , you could go to index.template.php and find the "function theme_linktree()", then remove everything inbetween. Leave the function name and brackets, so calls still finds it.

1MileCrash

okay. Thanks bloc.

Reason for me asking, i modified the smf default. I want it to use x-small text in posts and on the index and such. But the link tree was already in x-small text, so when i changed the overall text to x-small, it made the link tree REALLY small. Impossible to read, like it looked stupid.. So how can i make the link tree and the forum text the same size?
The only thing php can't do is tell you how much milk is left in the fridge.



bloc

If you look at that link-tree function, you will see that it is defined as "font-size: smaller". just change "smaller" to your preferred (x-small or whatever) and you are set.

1MileCrash

and that's in style.css? Or index.template? Or what? I cant find that in style .css.
The only thing php can't do is tell you how much milk is left in the fridge.



dtm.exe

Quote from: Tippmaster on June 21, 2005, 02:21:28 PM
and that's in style.css? Or index.template? Or what? I cant find that in style .css.

I think it's in intex.template.php.

-Dan The Man

1MileCrash

#8
got it. Thanks you guys  :)

No problem :).

-Dan The Man
The only thing php can't do is tell you how much milk is left in the fridge.



osckar

Ok, here's what I'm trying to do with medium success..

I have moved my link tree in order to appear above the userinfo box (in other words, instead of the forum name & logo that I don't use anymore)

First, I tried to copy all the function theme_linktree() and paste where I want it to appear, but I get a "fatal error: cannot redeclare function ... etc.."

Then I just deleted the function theme_linktree() from its original location and left the new one but I see the link tree in the same position as it was before, above and below the main forum content.

I'm really stuck with this, so here's my code:

// The logo and the three info boxes.
   echo '
      <table cellspacing="1" cellpadding="0" border="0" align="center" width="770" style="position: relative;">
         <tr>
            <td colspan="3" valign="bottom" style="padding: 5px; white-space: nowrap;">';

   // This part is the logo and forum name.  You should be able to change this to whatever you want...
   function theme_linktree()
{
   global $context, $settings, $options;

   // Folder style or inline?  Inline has a smaller font.
   echo '<span class="nav"', $settings['linktree_inline'] ? ' style="font-size: smaller;"' : '', '>';

   // Each tree item has a URL and name.  Some may have extra_before and extra_after.
   foreach ($context['linktree'] as $link_num => $tree)
   {
      // Show the | | |-[] Folders.
      if (!$settings['linktree_inline'])
      {
         if ($link_num > 0)
            echo str_repeat('<img src="' . $settings['images_url'] . '/icons/linktree_main.gif" alt="| " border="0" />', $link_num - 1), '<img src="' . $settings['images_url'] . '/icons/linktree_side.gif" alt="|-" border="0" />';
         echo '<img src="' . $settings['images_url'] . '/icons/folder_open.gif" alt="+" border="0" />&nbsp; ';
      }

      // 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 $settings['linktree_inline'] ? ' &nbsp;|&nbsp; ' : '<br />';
   }

   echo '</span>';
   }
   echo '
            </td>
         </tr>
         <tr id="upshrinkHeader"', empty($options['collapse_header']) ? '' : ' style="display: none;"', '>
            <td valign="top">
               <div class="headertitles" style="margin-right: 5px; position: relative;"><img src="', $settings['images_url'], '/blank.gif" height="12" alt="" /></div>
               <div class="headerbodies" style="position: relative; margin-right: 5px; background-image: url(', $settings['images_url'], '/box_bg.gif);">
                  <img src="', $settings['images_url'], '/', $context['user']['language'], '/userinfo.gif" style="position: absolute; left: ', $context['browser']['is_ie5'] || $context['browser']['is_ie4'] ? '0' : '-1px', '; top: -16px; clear: both;" alt="" />
                  <table width="450" cellpadding="0" cellspacing="2" border="0"><tr>';

   if (!empty($context['user']['avatar']))
      echo '<td valign="middle">', $context['user']['avatar']['image'], '</td>';

   echo '<td width="100%" valign="top" class="smalltext" style="font-family: verdana, arial, sans-serif;">';

   // If the user is logged in, display stuff like their name, new messages, etc.


Im using the default template, modified, of course  ;)

Any help or guidance will be appreciated.

Oscar

bloc

You are just moving the function, while you should move the call to the function. Where its called, is where its shown. Copying and pasting the function render error becuase 2 functions with the same name can't exist..

Here is an idea:

1. copy current theme_linktree() function to right below it (in index.template.php)
2. rename this second to my_linktree() and just leave it be.
3. go back to theme_linktree and remove everything between the "global $context, $settings, $options;" and the }. Make sure you have that }, so the function is closed.
4. just find the spot where you want it to appear, and call it like "my_linktree();"

This way, all the calls to theme_linktree, which is in almost all the templates(!) will now just render a dummy function, while your copy ( my_linktree ) will render as before - and it will be present in all pages, for example on top.

osckar

okidoki

I will try it and let you know

Thank you Bloc ;)

osckar

Hi Bloc:

I followed your directions but I get template errors:

here's the code:

   echo '
   </body>
</html>';
}

// Show a linktree.  This is that thing that shows "My Community | General Category | General Discussion"..
function theme_linktree()
{
   global $context, $settings, $options;
   }

   echo '</span>';
   }
// another linktree...
function my_linktree()
{
   global $context, $settings, $options;

   // Folder style or inline?  Inline has a smaller font.
   echo '<span class="nav"', $settings['linktree_inline'] ? ' style="font-size: smaller;"' : '', '>';

   // Each tree item has a URL and name.  Some may have extra_before and extra_after.
   foreach ($context['linktree'] as $link_num => $tree)
   {
      // Show the | | |-[] Folders.
      if (!$settings['linktree_inline'])
      {
         if ($link_num > 0)
            echo str_repeat('<img src="' . $settings['images_url'] . '/icons/linktree_main.gif" alt="| " border="0" />', $link_num - 1), '<img src="' . $settings['images_url'] . '/icons/linktree_side.gif" alt="|-" border="0" />';
         echo '<img src="' . $settings['images_url'] . '/icons/folder_open.gif" alt="+" border="0" />&nbsp; ';
      }

      // 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 $settings['linktree_inline'] ? ' &nbsp;|&nbsp; ' : '<br />';
   }

   echo '</span>';
   }
// Show the menu up top.  Something like [home] [help] [profile] [logout]...
function template_menu()


I have renamed the new linktree function and pasted my_linktree(); where I want it to appear but no sucess, maybe I missed something, a closing tag.

Thank you

bloc

This section:
/ Show a linktree.  This is that thing that shows "My Community | General Category | General Discussion"..
function theme_linktree()
{
   global $context, $settings, $options;
   }

   echo '</span>';
   }


..needs to look like this:
/ Show a linktree.  This is that thing that shows "My Community | General Category | General Discussion"..
function theme_linktree()
{
   global $context, $settings, $options;
}



osckar

You are right! It's working now..

Just one thing: the original linktree is not appearing in its original locations (above & below forum) only the new my_linktree at the top.

what would be happening?

Oscar

bloc

Since you have "emptied" that function, it just does nothing..and nothing is displayed of course. The alternative would have to be adjusting all the templates that had a call to theme_linktree. :)

But if you want it both places, you can always remove my_linktree, set theme_linktree back to before, and call just theme_linktree on the top - as you now do with my_linktree. 

osckar

Yes I have suspected that  ;D Now it's ok, I have the linktree at the top and the default ones.

This is my code.

// The logo and the three info boxes.
   echo '
      <table cellspacing="1" cellpadding="0" border="0" align="center" width="770" style="position: relative;">
         <tr>
            <td colspan="2" valign="bottom" style="padding: 1px; white-space: nowrap;">';

// This part is the logo and forum name.  You should be able to change this to whatever you want...
   echo '
   <table width="100%" cellpadding="2" cellspacing="0" border="0" align="default">
      <tr>
  <td valign="bottom">', theme_linktree(), '</td>
   </tr></table>
            </td>
         </tr>
         <tr id="upshrinkHeader"', empty($options['collapse_header']) ? '' : ' style="display: none;"', '>
            <td valign="top">
               <div class="headertitles" style="margin-right: 5px; position: relative;"><img src="', $settings['images_url'], '/blank.gif" height="12" alt="" /></div>
               <div class="headerbodies" style="position: relative; margin-right: 5px; background-image: url(', $settings['images_url'], '/box_bg.gif);">
                  <img src="', $settings['images_url'], '/', $context['user']['language'], '/userinfo.gif" style="position: absolute; left: ', $context['browser']['is_ie5'] || $context['browser']['is_ie4'] ? '0' : '-1px', '; top: -16px; clear: both;" alt="" />
                  <table width="450" cellpadding="0" cellspacing="2" border="0"><tr>';


Looks fine in IE but in Firefox I've noticed that the new linktree doesn't break inside the table, I mean, it extends in one line getting out the screen if the navigation is long.

My table is fine, as IE renders the code as it is. Do you know any fix for this in Firefox?

bloc

Yes, its the small code in your example that reads "white-space: nowrap;" that probably does it. Try to remove it, but beware it might influence other things too(or maybe not) :)

Advertisement: