Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: 1MileCrash on August 29, 2005, 09:44:48 PM

Title: adding "new posts" links to classic theme.
Post by: 1MileCrash on August 29, 2005, 09:44:48 PM
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.
Title: Re: adding "new posts" links to classic theme.
Post by: hawkman on September 04, 2005, 10:58:23 PM
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
Title: Re: adding "new posts" links to classic theme.
Post by: 1MileCrash on September 04, 2005, 11:03:24 PM
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

Title: Re: adding "new posts" links to classic theme.
Post by: hawkman on September 05, 2005, 10:53:04 PM
Tippmaster,

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

Thank You
Title: Re: adding "new posts" links to classic theme.
Post by: level42 on September 12, 2005, 09:54:23 PM
It is great!  ;D
Title: Re: adding "new posts" links to classic theme.
Post by: auroramae on October 23, 2005, 12:41:41 PM
Hi,
I've tried it myself and am getting parse errors.
Wht's the bast tect editor to use in Windows.
Title: Re: adding "new posts" links to classic theme.
Post by: 1MileCrash on October 23, 2005, 12:47:36 PM
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
Title: Re: adding "new posts" links to classic theme.
Post by: auroramae on October 23, 2005, 01:09:56 PM
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!!

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

Thanks
Title: Re: adding "new posts" links to classic theme.
Post by: joejackson on December 12, 2007, 10:27:54 PM
Worked fine on 1.1.4
Title: Re: adding "new posts" links to classic theme.
Post by: marcbo on September 30, 2009, 04:06:18 AM
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.

Title: Re: adding "new posts" links to classic theme.
Post by: Arantor on September 30, 2009, 04:14:09 AM
   // 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.
Title: Re: adding "new posts" links to classic theme.
Post by: mikeart on October 10, 2009, 01:29:15 AM
Could this be used in other themes such as Leviathan thanks Mike.
Title: Re: adding "new posts" links to classic theme.
Post by: Arantor on October 10, 2009, 06:11:58 AM
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.
Title: Re: adding "new posts" links to classic theme.
Post by: mikeart on October 10, 2009, 06:18:23 AM
Thanks for the reply, i will have to think about this, have a great weekend cheers.
Title: Re: adding "new posts" links to classic theme.
Post by: Arantor on October 11, 2009, 05:58:30 AM
Please advise if you do need further support on this.
Title: Re: adding "new posts" links to classic theme.
Post by: Zirc on January 06, 2010, 09:25:47 PM
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.