Hello Guest
No Avatar
Sign In to Remove
Posts: 
5
Reputation: 
2
Posted: January 20, 2012, 6:17 AM
  • Group: Member
I hope you can show me what I am missing. I have edited the theme source from the tutorial to change the header on Prince of Darkness by Antechinus. It is a curve variant. I have changed the class on a couple of items, and added it to css. I have also replaced the PM info in topbar to reflect unread posts and unread replies. I added the news to the middle bar div. I also changed the colors of course to match the dark theme. The theme works, sort of. :) There are no parse errors, but the middle div disappears upon logout.
I am sure it has to do with this- if ($context['user']['is_logged']) in the top_bar_guts div. 
When logged in, everything works and is where I want it, and then upon logout, the entire middle, middle_innner, and middle_guts div simply does not display, but everything else does. 
I am an extreme PHP novice, so I am guessing it is something simple.
here is just the portion that I have altered from index.template.php 

Code: [Select]
echo '
</head>
<body>';
}

function template_body_above()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
echo '
<div class="top_bar">
<div class="top_bar_inner" style="width: ', !empty($settings['forum_width']) ? $settings['forum_width'] : '' ,'">
<div class="top_bar_guts">
<div class="floatleft">';
if ($context['user']['is_logged'])
echo '
<span><a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a> &nbsp;
<a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a></span>

</div>

<div class="floatright">
<span>', $context['current_time'], '</span>
</div>
</div>
</div>
</div>

<div class="middle">
<div class="middle_inner" style="width: ', !empty($settings['forum_width']) ? $settings['forum_width'] : '' ,'">
<div class="middle_guts">
<div class="logo_banner">
<a href="', $scripturl, '">', empty($context['header_logo_url_html_safe']) ? $context['forum_name'] : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name'] . '" />', '</a>
</div>

<div class="middle_quick_search">
<div class="floatright">
<div class="themenews">
';
// Show a random news item? (or you could pick one from news_lines...)
if (!empty($settings['enable_news']))
echo '
<p>', $txt['news'], ': </p>
<p>', $context['random_news_line'], '</p>';
echo '
</div>
</div>
</div>
</div>
</div>
</div>

<div class="nav_bar">
<div class="nav_bar_inner" style="width: ', !empty($settings['forum_width']) ? $settings['forum_width'] : '' ,'">
<div class="nav_bar_guts">
', template_menu() ,'
</div>
</div>
</div>
';
echo !empty($settings['forum_width']) ? '
<div id="wrapper" style="width: ' . $settings['forum_width'] . '">' : '', '
';
// The main content should go here.
echo '
<div id="content_section"><div class="frame">
<div id="main_content_section">';
Posts: 
400
Reputation: 
20
Posted: January 20, 2012, 7:06 AM  -- Last Edit: January 20, 2012, 7:26 AM by MLM
  • Group: Administrator
  • AIM: mlm@visualpulse.net
  • deviantART: MadLittleMods
  • Photobucket: MadLittleMods
Well, you had some mistakes such as not closing off the echo '';, not putting code in the if statement that should be, and more of a personal preference which is indenting. Make sure to indent every new layer of element so that it is easier to look at your code to see what is wrong with it.

Your main issue was that you had the <div class="floatleft"> outside of the if statement echo and not closing off the echo for the if statement and starting a new one.

You can leave out the brackets but I like to put them in for readability. Just make sure if you are going to leave out the brackets that you make a echo for the if and then another echo for the other content.

For ex.
Code: [Select]
if($happy)
echo '
yay';

echo'
other content';

Code: [Select]
echo '
<div class="top_bar">
<div class="top_bar_inner" style="width: ', !empty($settings['forum_width']) ? $settings['forum_width'] : '' ,'">
<div class="top_bar_guts">
';
if ($context['user']['is_logged'])
{
echo '
<div class="floatleft">
<span>
<a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a> &nbsp;
<a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a>
</span>
</div>';
}
echo '
<div class="floatright">
<span>', $context['current_time'], '</span>
</div>

</div>
</div>
</div>
';
<3 Nerve, Sk8, Labradoodle, Austin
Posts: 
5
Reputation: 
2
Posted: January 20, 2012, 7:10 AM
  • Group: Member
Cool. I knew it was a simple and rookie mistake, but I was bashing my brain trying to find it for over 2 hours.  :) I figured I would bring it here and see what I missed. I appreciate it much. I like the header, just had a few preferences for myself. Thanks again.  :)
Posts: 
5
Reputation: 
2
Posted: January 20, 2012, 7:18 AM
  • Group: Member
ooops  I get a parse error now. I attached the whole file. It seems that I must have missed something elsewhere and adding in your edit brought it out.
Posts: 
400
Reputation: 
20
Posted: January 20, 2012, 7:23 AM  -- Last Edit: January 20, 2012, 7:26 AM by MLM
  • Group: Administrator
  • AIM: mlm@visualpulse.net
  • deviantART: MadLittleMods
  • Photobucket: MadLittleMods
ooops  I get a parse error now. I attached the whole file. It seems that I must have missed something elsewhere and adding in your edit brought it out.

woops, You just copy pasted my code without adding the echo's at the top and bottom which is partially my fault. Here is the template back, should work.

Changed my other reply so it is more proper as well
<3 Nerve, Sk8, Labradoodle, Austin
Posts: 
5
Reputation: 
2
Posted: January 20, 2012, 7:31 AM
  • Group: Member
Yep, I did. It works now.  I need to get away from the computer and go get a cup of coffee.
Thanks much.   :)