News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Enforcing linktree layout

Started by Alexandre P., July 11, 2005, 01:52:33 PM

Previous topic - Next topic

Alexandre P.

Hi all,

Is there a way, in the template file, to enforce the way the linktree is displayed?

The goal is to show a linktree in a tree form above a topic and the same linktree, but in an inline form, under the topic.

Thanks for any suggestion :)
Aucun support par M.P., courriel ou messagerie instantanée / No support by P.M., email or I.M.

bjp

Up !

Is there also a way to separate the ¨post Reply in a line after </br>

Simple Machines Community Forum  |  SMF Development  |  Graphics and Templates  |
Post reply ( Re: Enforcing linktree layout )

bloc

Quote from: Alexandre P. on July 11, 2005, 01:52:33 PM
Hi all,

Is there a way, in the template file, to enforce the way the linktree is displayed?

The goal is to show a linktree in a tree form above a topic and the same linktree, but in an inline form, under the topic.

Thanks for any suggestion :)

It could be done if the link_tree function can take a parameter, and from that parameter decide if it should render it inline.  Like this:

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

        // Folder style or inline?  Inline has a smaller font.
        echo '<span class="nav"', $use_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 (!$use_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 $use_inline ? ' &nbsp;|&nbsp; ' : '<br />';
        }

        echo '</span>';
}


Then all calls that goes like theme_linktree(); will render treeform ( all the usual ones), and a call like theme_linktree(true) will render it inline regardless.   

Quote from: bjp on July 11, 2005, 02:18:44 PM
Up !

Is there also a way to separate the ¨post Reply in a line after </br>

Simple Machines Community Forum  |  SMF Development  |  Graphics and Templates  |
Post reply ( Re: Enforcing linktree layout )


A bit difficult perhaps..if you are in calendar for example, what should you reply to...? Putting it down under the copyright means it will show on all pages, whereas this should maybe only show on the actual showing of posts?

Alexandre P.

Quote from: Bloc on July 11, 2005, 02:52:49 PM
It could be done if the link_tree function can take a parameter, and from that parameter decide if it should render it inline.  Like this:

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

        // Folder style or inline?  Inline has a smaller font.
        echo '<span class="nav"', $use_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 (!$use_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 $use_inline ? ' &nbsp;|&nbsp; ' : '<br />';
        }

        echo '</span>';
}


Then all calls that goes like theme_linktree(); will render treeform ( all the usual ones), and a call like theme_linktree(true) will render it inline regardless.
I've been searching where I should edit the function theme_linktree() 'cause it already exists), but did not find in which file it is located :-[

   
Quote from: Bloc on July 11, 2005, 02:52:49 PM
Quote from: bjp on July 11, 2005, 02:18:44 PM
Up !

Is there also a way to separate the ¨post Reply in a line after </br>

Simple Machines Community Forum  |  SMF Development  |  Graphics and Templates  |
Post reply ( Re: Enforcing linktree layout )


A bit difficult perhaps..if you are in calendar for example, what should you reply to...? Putting it down under the copyright means it will show on all pages, whereas this should maybe only show on the actual showing of posts?
I suppose he means having something like
My forum | My board <br />
Post reply (Re: my topic)
not putting the Post reply (...) under the copyright ;D
Aucun support par M.P., courriel ou messagerie instantanée / No support by P.M., email or I.M.

bloc

eh...how did I get that wrong.. ;D ( might have something to do with a certain copyright thread :P )

The link_tree function? Thats in index.template.php.

Alexandre P.

#5
yeah, you're right ;)  Thanks  :D

For the <br /> before Post reply, I guess it would be too complicated because of the way the link tree is rendered as an unique variable...

Edit: http://www.simplemachines.org/community/index.php?topic=30772.0 this theme might have something interesting to reveal
Aucun support par M.P., courriel ou messagerie instantanée / No support by P.M., email or I.M.

bloc

You can manipulate the linktree function pretty much to your liking..the effect of that theme is not hard to do. I did the same for a VB-lookalike theme once. But the "post reply" bit is a harder. Not the actual link..but the fact that a reply link needs a topic number - and where is that when you are in the calendar - or on frontpage for example?

You could check partly where you are....but its still just possible to reply in the posts area.

But back to the break like that..this can be done like this:

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

        // Folder style or inline?  Inline has a smaller font.
        echo '<span class="nav">';

        // 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'];

                if (($link_num == count($context['linktree']) - 1) && count($context['linktree'])>1)
                        echo '<br />  - ';

                // 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 '</span>';
}


this would show:

home > category > discussion >
- thread


I have just used a "-" but anything can be used, a image like the Aquasoft theme or a symbol, text etc.

Alexandre P.

Waw, thanks a lot for all those informations !
Aucun support par M.P., courriel ou messagerie instantanée / No support by P.M., email or I.M.

Advertisement: