adding "new posts" links to classic theme.

Started by 1MileCrash, August 29, 2005, 09:44:48 PM

Previous topic - Next topic

1MileCrash

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

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.



hawkman

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

1MileCrash

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.



hawkman

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


auroramae

Hi,
I've tried it myself and am getting parse errors.
Wht's the bast tect editor to use in Windows.

1MileCrash

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.



auroramae

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!!


bobw

It worked for me with no crashes or bother on v. 1.1 RC1!

mforum

works perfect on 1.0.5, its great, something should be there by default..!!! Thanks a LOT  :)

kenwvs

This worked like a charm on version 1.1rc3

Thanks

joejackson


marcbo

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.


Arantor

   // 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.

mikeart

Could this be used in other themes such as Leviathan thanks Mike.

Arantor

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.

mikeart

Thanks for the reply, i will have to think about this, have a great weekend cheers.

Arantor

Please advise if you do need further support on this.

Zirc

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.

Advertisement: