Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: NOS ChromeNut on August 15, 2005, 03:35:17 PM

Title: Go Up button
Post by: NOS ChromeNut on August 15, 2005, 03:35:17 PM
Hi all!  I'm very happy to be a proud SMF user (gee, sounds like a new drug!), and am thoroughly enjoying the forums I've created with this fine product.  Great job dev team!!

I posted a similar question in the 1.0.5 thread, but it actually belonged here and the answer I got over there was extremely vague to say the least.  Maybe here it will get a little more attention.

I know that you can define the number of posts viewed in a thread, and that it's controlled through the admin panel (not sure if it's user controlled or not, but doesn't matter), but what if you're posts are realllllly long, and even if you limit view of 9 posts to a page it still can be rather lengthy, and I'm wearing out the scroll button on my mouse.

Is there no way to embed the Go Up button in each post, similar to phpBB, so that if you want to go to the top of the page you can at any point?  It must not be terribly hard but I'm no SMF whiz.

Kindest regards and best wishes to all SMF'ers!!

RobinH
 :-*
Title: Re: Go Up button
Post by: codenaught on August 15, 2005, 04:02:33 PM
In Themes/default/Display.template.php


Find:

Code: [Select]
<a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/modify.gif" alt="' . $txt[66] . '" border="0" />' : $txt[17]), '</a>';
Add:
Code: [Select]
echo '  <a href="#top">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/go_up.gif" alt="' . $txt['topbottom4'] . '" border="0" align="top" />' : $txt['topbottom4']) . '</a>';
That will add it after the Modify button.
Title: Re: Go Up button
Post by: NOS ChromeNut on August 18, 2005, 09:28:54 PM
In Themes/default/Display.template.php

That will add it after the Modify button.

OMG that did it!!! Love ya!!!!! That was just too darned simple.

 ;D
Title: Re: Go Up button
Post by: anunlike on August 18, 2005, 09:34:53 PM
Could this be made a feature?
Title: Re: Go Up button
Post by: JayBachatero on August 18, 2005, 11:07:19 PM
Could this be made a feature?

its all a matter of choice of the theme developers.  there are themes that come with this.
Title: Re: Go Up button
Post by: anunlike on August 19, 2005, 12:02:16 AM
Yeah, I didn't think about that. Thanks.
Title: Re: Go Up button
Post by: JayBachatero on August 19, 2005, 12:10:24 AM
the theme i ave comes with it.  http://www.kevmundial.com/board/index.php?board=1.0
Title: Re: Go Up button
Post by: dtm.exe on August 19, 2005, 12:12:33 AM
akabugeyes, nice work.  This is definitley worthy being in the Tips and Tricks board, IMO.

-Dan The Man
Title: Re: Go Up button
Post by: JayBachatero on August 19, 2005, 12:14:20 AM
its weird though if the image and the text is there why its not in the theme?
Title: Re: Go Up button
Post by: dtm.exe on August 19, 2005, 12:15:38 AM
its weird though if the image and the text is there why its not in the theme?

It's just one of those additional and optional options.

-Dan The Man
Title: Re: Go Up button
Post by: JayBachatero on August 19, 2005, 12:20:07 AM
oic.  maybe it should be added to the theme options were you can check it off if you want it on or off.
Title: Re: Go Up button
Post by: Xarcell on August 19, 2005, 10:41:08 PM
Hey, can we get this tread listed in teh tip & tricks index?

If not already listed (if I overlooked).

Thanx,

-Xarcell
Title: Re: Go Up button
Post by: gravesend46 on November 22, 2005, 11:20:10 AM
THis is kinda weird, but it replaces the MODIFY tab on my forum rather than sits alongside it.... ???
Title: Re: Go Up button
Post by: Simplemachines Cowboy on November 22, 2005, 03:12:24 PM
Alignment is off.
The up button is a couple of pixels aboue the others.

I removed the
Quote
align="top"
and made it
Quote
'" border="0" />'
and it aligns just fine.
Title: Re: Go Up button
Post by: edi67 on November 23, 2005, 12:51:36 AM
In Themes/default/Display.template.php


Find:

Code: [Select]
<a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/modify.gif" alt="' . $txt[66] . '" border="0" />' : $txt[17]), '</a>';
Add:
Code: [Select]
echo '  <a href="#top">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/go_up.gif" alt="' . $txt['topbottom4'] . '" border="0" align="top" />' : $txt['topbottom4']) . '</a>';
That will add it after the Modify button.

this trip not work with FIREFOX in index.teamplte.php , appear button but clicking it nothing appear some solution for make it work ?
Title: Re: Go Up button
Post by: DJ Rg on May 07, 2006, 09:47:39 AM
How about a code for a "Go Down" Button ..also seems SMF use text links at top and button ..what would the code be to change the text to buttons, also where would that code go..

thanks..

 8)
Title: Re: Go Up button
Post by: Arbalot on May 07, 2006, 09:53:24 AM
in display.template.php
here
Code: [Select]
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="middletext" valign="bottom" style="padding-bottom: 4px;">', $txt[139], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . ' &nbsp;&nbsp;<a href="#lastPost"><b>' . $txt['topbottom5'] . '</b></a>' : '', '</td>
<td align="right" style="padding-right: 1ex;">
<div class="nav" style="margin-bottom: 2px;"> ', $context['previous_next'], '</div>
<table cellpadding="0" cellspacing="0">
<tr>
', template_button_strip($normal_buttons, 'bottom'), '
</tr>
</table>

Code: [Select]
<a href="#lastPost"><b>' . $txt['topbottom5'] . '</b></a>
in messageindex.templte.php
here
Code: [Select]
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="middletext">', $txt[139], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . '&nbsp;&nbsp;<a href="#bot"><b>' . $txt['topbottom5'] . '</b></a>' : '', '</td>
<td align="right" style="padding-right: 1ex;">
<table cellpadding="0" cellspacing="0">
<tr>
', template_button_strip($normal_buttons, 'bottom'), '
</tr>
</table>
</td>
</tr>
</table>';

Code: [Select]
<a href="#bot"><b>' . $txt['topbottom5'] . '</b></a>
Title: Re: Go Up button
Post by: DJ Rg on May 07, 2006, 10:52:09 AM
i am sorry, i dont understand ..my template already has that info in it ..what do i change ..and what do i change it too?

this is for the "Go To Top" Button correct? What do i do/use for the "Go To Bottom" button?
Title: Re: Go Up button
Post by: JayBachatero on May 07, 2006, 02:08:28 PM
That is for the go bottom link.
Title: Re: Go Up button
Post by: DJ Rg on May 07, 2006, 04:34:28 PM
yes i know ..but i dont understand what code goes where...

this is
<a href="#lastPost"><b>' . $txt['topbottom5'] . '</b></a>

already in here...

in display.template.php
here
Code: [Select]
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="middletext" valign="bottom" style="padding-bottom: 4px;">', $txt[139], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . ' &nbsp;&nbsp;<a href="#lastPost"><b>' . $txt['topbottom5'] . '</b></a>' : '', '</td>
<td align="right" style="padding-right: 1ex;">
<div class="nav" style="margin-bottom: 2px;"> ', $context['previous_next'], '</div>
<table cellpadding="0" cellspacing="0">
<tr>
', template_button_strip($normal_buttons, 'bottom'), '
</tr>
</table>

~*~

and this..
Code: [Select]
<a href="#bot"><b>' . $txt['topbottom5'] . '</b></a>
is already in here...


in messageindex.templte.php
here
Code: [Select]
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="middletext">', $txt[139], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . '&nbsp;&nbsp;<a href="#bot"><b>' . $txt['topbottom5'] . '</b></a>' : '', '</td>
<td align="right" style="padding-right: 1ex;">
<table cellpadding="0" cellspacing="0">
<tr>
', template_button_strip($normal_buttons, 'bottom'), '
</tr>
</table>
</td>
</tr>
</table>';



as it is also now in my templates..

i dont understand what i am suppose change and where?
Title: Re: Go Up button
Post by: DJ Rg on May 08, 2006, 06:00:49 PM
why is it so hard to get help in here ..i have a few post that just keep get old ..usually i do get an answer but if i dont understand ..no one bothers to explain ..

anyways i do not understand the instruction to creating the buttons to replace the text go up and go down at the top and bottom of a topic..

seems like a lot of people would rather have buttons for this?

Thank you.