Uutiset:

Wondering if this will always be free?  See why free is better.

Main Menu
Advertisement:

Welcome text / unread messages link

Aloittaja liability, toukokuu 23, 2011, 11:08:40 IP

« edellinen - seuraava »

liability

Hi everyone,

Does the following code require anything else to work? Nothing displays, whether someone is logged in or not.

SMF 1.1.3
It's in the template_main_above() function with the global $context, $settings, $options, $scripturl, $txt, $modSettings included.


       // Are they logged in?
if ($context['user']['is_logged'])
{
echo '<b>', $txt['hello_member_ndt'], ' ', $context['user']['name'], '</b><br />
<a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a><br /><a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a><br />';
}
// Otherwise they're a guest - this time ask them to either register or login
else
{
echo ' ', $txt['welcome_guest'], '</div> ';
}


Pretty sure I'm missing something, just not sure what. Any guidance would be appreciated!

Sir Osis of Liver

#1

The code is correct.  Where are you trying to put it on the page?

When in Emor, do as the Snamors.
                              - D. Lister

liability

That makes me feel a little better I think :)

It's right after the logo (top left - which displays), but I removed the logo thinking something there might be messing with it. But it still doesn't display.  Anyhow, this is what it looks like from the <body> down through news (which works)


<body>
   <div id="header">
      <div id="head-l">
<div id="head-r">
   <a href="'.$scripturl.'?action=forum" title=""><span id="logo"> </span></a>';
   
           echo' <div id="userpanel"> ';

// Are they logged in?
if ($context['user']['is_logged'])
{
      echo '<b>', $txt['hello_member_ndt'], ' ', $context['user']['name'], '</b><br />';
  echo '<a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a><br /><a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a></div>';
}
// Otherwise they're a guest - this time ask them to either register or login - lazy bums...
else
{
echo ' ', $txt['welcome_guest'], '</div>';
}

       // Show News
echo'
<div id="newspanel">
   <span class="news"><b>', $txt[102], '</b>: <br />', $context['random_news_line'], '</span>
</div>';


I've tried it with, and without the 'userpanel' background. Something is causing it to break, or I'm missing something that makes it work.

P.S. Sorry about the cross post. I posted here, then thought it was better somewhere else and posted there. Came back to here, and found I can't remove my own posts :(

Tomy Tran

It may still work, but go to somewhere else that area is not on the screen (example of 1100 of 1024 pixel) cause you have removed some div or id of its' css?

Just try to open source code of site from menu view of your browser and find them (ex: action=unreadreplies ). You may still find it works well.

liability

Appreciate the reply Tomy Tran!

That was a good thought, which I had neglected to do.


I just checked the source (in the browser) and it's not anywhere in the source.  :(

Sir Osis of Liver


I tried the code last night in 1.1.13 and RC5 default, and it works.

Hold on, I'll take a look. 


When in Emor, do as the Snamors.
                              - D. Lister

Sir Osis of Liver


Which theme are you using?

Where exactly do you want to display this?

Can you attach your index.template.php?

When in Emor, do as the Snamors.
                              - D. Lister

liability

Coding issue solved!

So I was using Notepad++ to do all my editing. Pretty much, all settings in notepadd++ were default. Always worked before, so didn't give it any thought. (I did find it annoying that every line had a blank line under it - but whatever)

I switched to Dreamweaver (same blank line issue mind you) - made the quick change, and IT WORKS.

I'm using Windows 7 here, and uploading to a linux webhost. Can anyone enlighten me as to how I should setup Notepad++ so I don't have issues going forward?

(This isn't my first time customizing a theme - notepad++ has always worked fine in the past)


Thanks to everyone who was trying to help, it's much appreciated :)

Advertisement: