Advertisement:

Author Topic: adding "new posts" links to classic theme.  (Read 29529 times)

Offline Tippmaster

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,188
adding "new posts" links to classic theme.
« 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-
 
Code: [Select]
  // 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-
Code: [Select]
   // 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

just something i did really quick. played with it a while, this is the nicest looking ive got.
The only thing php can't do is tell you how much milk is left in the fridge.



Offline hawkman

  • Jr. Member
  • **
  • Posts: 219
  • Gender: Male
Re: adding "new posts" links to classic theme.
« Reply #1 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
All that is necessary for evil to prosper is that good men do nothing - Edmund Burke

Offline Tippmaster

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,188
Re: adding "new posts" links to classic theme.
« Reply #2 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

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



Offline hawkman

  • Jr. Member
  • **
  • Posts: 219
  • Gender: Male
Re: adding "new posts" links to classic theme.
« Reply #3 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
All that is necessary for evil to prosper is that good men do nothing - Edmund Burke

Offline level42

  • Semi-Newbie
  • *
  • Posts: 34
Re: adding "new posts" links to classic theme.
« Reply #4 on: September 12, 2005, 09:54:23 PM »
It is great!  ;D

Offline auroramae

  • Jr. Member
  • **
  • Posts: 216
Re: adding "new posts" links to classic theme.
« Reply #5 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.

Offline Tippmaster

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,188
Re: adding "new posts" links to classic theme.
« Reply #6 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
The only thing php can't do is tell you how much milk is left in the fridge.



Offline auroramae

  • Jr. Member
  • **
  • Posts: 216
Re: adding "new posts" links to classic theme.
« Reply #7 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!!


Offline bobw

  • Semi-Newbie
  • *
  • Posts: 47
Re: adding "new posts" links to classic theme.
« Reply #8 on: November 04, 2005, 08:48:01 PM »
It worked for me with no crashes or bother on v. 1.1 RC1!

Offline mforum

  • Full Member
  • ***
  • Posts: 609
  • Gender: Male
  • PRESS START TO PLAY
Re: adding "new posts" links to classic theme.
« Reply #9 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  :)

Offline kenwvs

  • Semi-Newbie
  • *
  • Posts: 23
Re: adding "new posts" links to classic theme.
« Reply #10 on: October 05, 2006, 07:48:20 PM »
This worked like a charm on version 1.1rc3

Thanks

Offline joejackson

  • Jr. Member
  • **
  • Posts: 144
Re: adding "new posts" links to classic theme.
« Reply #11 on: December 12, 2007, 10:27:54 PM »
Worked fine on 1.1.4

Offline marcbo

  • Semi-Newbie
  • *
  • Posts: 11
Re: adding "new posts" links to classic theme.
« Reply #12 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.


Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,041
    • Arantor on GitHub
Re: adding "new posts" links to classic theme.
« Reply #13 on: September 30, 2009, 04:14:09 AM »
Code: [Select]
   // 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.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline mikeart

  • Semi-Newbie
  • *
  • Posts: 19
    • PastReunited.com
Re: adding "new posts" links to classic theme.
« Reply #14 on: October 10, 2009, 01:29:15 AM »
Could this be used in other themes such as Leviathan thanks Mike.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,041
    • Arantor on GitHub
Re: adding "new posts" links to classic theme.
« Reply #15 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.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline mikeart

  • Semi-Newbie
  • *
  • Posts: 19
    • PastReunited.com
Re: adding "new posts" links to classic theme.
« Reply #16 on: October 10, 2009, 06:18:23 AM »
Thanks for the reply, i will have to think about this, have a great weekend cheers.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,041
    • Arantor on GitHub
Re: adding "new posts" links to classic theme.
« Reply #17 on: October 11, 2009, 05:58:30 AM »
Please advise if you do need further support on this.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline Zirc

  • Semi-Newbie
  • *
  • Posts: 93
Re: adding "new posts" links to classic theme.
« Reply #18 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.