Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Thema gestartet von: 1MileCrash in August 29, 2005, 09:44:48 NACHMITTAGS

Titel: adding "new posts" links to classic theme.
Beitrag von: 1MileCrash in August 29, 2005, 09:44:48 NACHMITTAGS
If you like using the classic theme, but dont like how there are no new post links, then do this.

find-
  // Show a random news item? (or you could pick one from news_lines...)
   if (!empty($settings['enable_news']))
      echo '
      <tr class="windowbg2">
         <td colspan="2" height="24" class="tborder" style="border-width: 1px 0 0 0; padding-left: 1ex;">
            <b>', $txt[102], ':</b> ', $context['random_news_line'], '
         </td>
      </tr>';

   echo '
</table>


make it-
   // Show a random news item? (or you could pick one from news_lines...)
   if (!empty($settings['enable_news']))
      echo '
      <tr class="windowbg2">
         <td colspan="2" height="24" class="tborder" style="border-width: 1px 0 0 0; padding-left: 1ex;">
            <b>', $txt[102], ':</b> ', $context['random_news_line'], '
         </td>
      </tr>';

   echo '
   <tr class="windowbg2"><td colspan="2"><table align="left"><tr><td style="padding-left: 15px;"><a href="index.php?action=unread"><font size="-2">Show unread posts since last visit.</font></a></td></tr></table><table align="right"><tr><td style="padding-right: 15px;"><a href="index.php?action=unreadreplies"><font size="-2">Show new replys to your posts.</font></a></td></tr></table></td></tr></table>


Result (http://paintplayers.com/smfthemes/index.php?;theme=2)

just something i did really quick. played with it a while, this is the nicest looking ive got.
Titel: Re: adding "new posts" links to classic theme.
Beitrag von: hawkman in September 04, 2005, 10:58:23 NACHMITTAGS
Real new and nervous about a crash.

Exactly which file path and file is this we are to edit?

If I understand it will give me a button or link to "all posts since the last login" if I am using the classic theme?

Thanks
Titel: Re: adding "new posts" links to classic theme.
Beitrag von: 1MileCrash in September 04, 2005, 11:03:24 NACHMITTAGS
the file is called index.template.php, and it is in the classic themes directory. You can edit this file from the admin cp

you wont 'crash' with this, the most damage you can do is mess up the template file, but your forum will still be usable from another theme.

This is what it does-
http://paintplayers.com/smfthemes/index.php?;theme=2

Titel: Re: adding "new posts" links to classic theme.
Beitrag von: hawkman in September 05, 2005, 10:53:04 NACHMITTAGS
Tippmaster,

It worked like a charm and this was a VERY important feature to me.

Thank You
Titel: Re: adding "new posts" links to classic theme.
Beitrag von: level42 in September 12, 2005, 09:54:23 NACHMITTAGS
It is great!  ;D
Titel: Re: adding "new posts" links to classic theme.
Beitrag von: auroramae in Oktober 23, 2005, 12:41:41 NACHMITTAGS
Hi,
I've tried it myself and am getting parse errors.
Wht's the bast tect editor to use in Windows.
Titel: Re: adding "new posts" links to classic theme.
Beitrag von: 1MileCrash in Oktober 23, 2005, 12:47:36 NACHMITTAGS
http://context.cx

you can just do it from the admincp..

show me the code and 3-5 lines below and above it, ill be able to tell you what's wrong
Titel: Re: adding "new posts" links to classic theme.
Beitrag von: auroramae in Oktober 23, 2005, 01:09:56 NACHMITTAGS
I was editing the template from the admin area, but since the changes  kept getting parse errors  and I needed to upload my backup repeatedly - I decided to edit with a text editor so I could undo changes easily.

So, as you mentioned,  Iwent back into the admin area and did it again --
and it worked.

Thank you so much.

It must have been my text editor

This looks really good

THANKS AGAIN!!

Titel: Re: adding "new posts" links to classic theme.
Beitrag von: bobw in November 04, 2005, 08:48:01 NACHMITTAGS
It worked for me with no crashes or bother on v. 1.1 RC1!
Titel: Re: adding "new posts" links to classic theme.
Beitrag von: mforum in Januar 27, 2006, 08:16:18 VORMITTAG
works perfect on 1.0.5, its great, something should be there by default..!!! Thanks a LOT  :)
Titel: Re: adding "new posts" links to classic theme.
Beitrag von: kenwvs in Oktober 05, 2006, 07:48:20 NACHMITTAGS
This worked like a charm on version 1.1rc3

Thanks
Titel: Re: adding "new posts" links to classic theme.
Beitrag von: joejackson in Dezember 12, 2007, 10:27:54 NACHMITTAGS
Worked fine on 1.1.4
Titel: Re: adding "new posts" links to classic theme.
Beitrag von: marcbo in September 30, 2009, 04:06:18 VORMITTAG
Hi,

Sorry to bump such an old topic, but here's my request.

I would like that these links are only shown to users that are logged in, and not to other unregistered users.

Titel: Re: adding "new posts" links to classic theme.
Beitrag von: Arantor in September 30, 2009, 04:14:09 VORMITTAG
   // Show a random news item? (or you could pick one from news_lines...)
   if (!empty($settings['enable_news']))
      echo '
      <tr class="windowbg2">
         <td colspan="2" height="24" class="tborder" style="border-width: 1px 0 0 0; padding-left: 1ex;">
            <b>', $txt[102], ':</b> ', $context['random_news_line'], '
         </td>
      </tr>';

   if($context['user']['is_logged'])
     echo '
   <tr class="windowbg2"><td colspan="2"><table align="left"><tr><td style="padding-left: 15px;"><a href="index.php?action=unread"><font size="-2">Show unread posts since last visit.</font></a></td></tr></table><table align="right"><tr><td style="padding-right: 15px;"><a href="index.php?action=unreadreplies"><font size="-2">Show new replies to your posts.</font></a></td></tr></table></td></tr>';

   echo '</table>


Strictly speaking this should use the reference to $txt but I can't remember what id it should be.
Titel: Re: adding "new posts" links to classic theme.
Beitrag von: mikeart in Oktober 10, 2009, 01:29:15 VORMITTAG
Could this be used in other themes such as Leviathan thanks Mike.
Titel: Re: adding "new posts" links to classic theme.
Beitrag von: Arantor in Oktober 10, 2009, 06:11:58 VORMITTAG
The general technique, yes. Exact code, no, because this code is geared to the original classic theme.

Without seeing the code for your theme, I couldn't say.
Titel: Re: adding "new posts" links to classic theme.
Beitrag von: mikeart in Oktober 10, 2009, 06:18:23 VORMITTAG
Thanks for the reply, i will have to think about this, have a great weekend cheers.
Titel: Re: adding "new posts" links to classic theme.
Beitrag von: Arantor in Oktober 11, 2009, 05:58:30 VORMITTAG
Please advise if you do need further support on this.
Titel: Re: adding "new posts" links to classic theme.
Beitrag von: Zirc in Januar 06, 2010, 09:25:47 NACHMITTAGS
Thanks for this code, I was able to modify it and put the links in my User Info block in SimplePortal and it works great!! Just what was needed.