Need help with undefined error

Started by Zirc, September 13, 2010, 06:27:59 PM

Previous topic - Next topic

Zirc

I'm getting the following error but i'm not sure what is causing it.  I'm thinking it's in my themes index.template.php in the function template_body_above but i'm not seeing anything that could cause this.

/test/index.php?action=admin
8: Undefined index: href
/test/Themes/default/PortalArticles.template.php (body_above sub template - eval?)
Line: 473


The error is the same no matter what page I visit.

YogiBear

First of all some groundwork, Zirc.

1. Which version of 2.0 are you using?

2. What mods have you installed?

3. Which language are you using and is it Utf8?
SMF v2.1.4  Mods : Snow & Garland v1.4, Simple Image Upload v2.0.0,  PHP  v.8.1

Zirc

Sorry about the version info I'll have to make a sig with that in it.

I'm using SMF 2.0RC3 and the language is just english and i don't believe it's utf-8 either.  I'm attaching a screenshot with my installed mods, easier than writing it out.

Zirc

Anybody have any ideas on which file I should be searching through to find this error?  Is it my themes index.template.php since it occurs on every page?  I've looked at that file at line 473 and there is nothing that would be causing this that I see.

Any ideas would be greatly appreciated.
Thanks

Zirc

/bump for fresh look at issue since my error log is getting rather large.

Here is the code for my body_above_template in the index.template.php I'm guessing the error is in there somewhere

function template_body_above()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings, $user_info;

echo '
<div id="mainframe"', !empty($settings['forum_width']) ? ' style="width: ' . $settings['forum_width'] . '"' : '', '>
<div class="tborderz">
<div class="catbgz">
';

if (empty($context['header_logo_url_html_safe']))
echo $context['forum_name_html_safe'];
else
echo '
<center><img src="', $context['header_logo_url_html_safe'], '" alt="', $context['forum_name_html_safe'], '" /></center>';

echo '

</div>';

// Display user name and time.
echo '
<table align="center" bordercolor="lime" width="99%" cellpadding="0" cellspacing="0" border="0" >
<tr>';
if ($context['user']['is_logged'])
echo '
<td align="center"  width="20"><img src="', $settings['theme_url'], '/images/titlebgheadlft.jpg"></td>
<td class="titlebghead" height="32" width="44%">
<span style="font-size: 130%;"> ', $txt['hello_member_ndt'], '&nbsp;', $user_info['group_name'], '&nbsp;', $context['user']['name'] , '</span>
</td>';
else
echo '
<td align="center"  width="20"><img src="', $settings['theme_url'], '/images/titlebgheadlft.jpg"></td>
<td class="titlebghead" height="32" width="44%">

</td>';
// display the time
echo '
<td align="center"  width="250"><img src="', $settings['theme_url'], '/images/headsaber.png" class="centeredImage"></td>
<td class="titlebghead" height="32" align="right" width="44%">
<span class="smalltext">' , $context['current_time'], '</span>';




echo ' </td><td align="center"  width="20"><img src="', $settings['theme_url'], '/images/titlebgheadrt.jpg"></td>
</tr></table>
';



// If the user is logged in, display stuff like their name, new messages, etc.
/*if ($context['user']['is_logged'])
{


// Is the forum in maintenance mode?
if ($context['in_maintenance'] && $context['user']['is_admin'])
echo '
<li class="notice">', $txt['maintain_mode_on'], '</li>';

// Are there any members waiting for approval?
if (!empty($context['unapproved_members']))
echo '
<li>', $context['unapproved_members'] == 1 ? $txt['approve_thereis'] : $txt['approve_thereare'], ' <a href="', $scripturl, '?action=admin;area=viewmembers;sa=browse;type=approve">', $context['unapproved_members'] == 1 ? $txt['approve_member'] : $context['unapproved_members'] . ' ' . $txt['approve_members'], '</a> ', $txt['approve_members_waiting'], '</li>';



if (!empty($context['open_mod_reports']) && $context['show_open_reports'])
echo '
<li><a href="', $scripturl, '?action=moderate;area=reports">', sprintf($txt['mod_reports_waiting'], $context['open_mod_reports']), '</a></li>';
echo '
</ul>';
} */
// Otherwise they're a guest - this time ask them to either register or login - lazy bums...
/* if (!empty($context['show_login_bar']))
{
echo '
<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/sha1.js"></script>
<form class="windowbgblank" id="guest_form" action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '" ', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
', $txt['login_or_register'], '<br />
<input type="text" name="user" size="10" class="input_text" />
<input type="password" name="passwrd" size="10" class="input_password" />
<select name="cookielength">
<option value="60">', $txt['one_hour'], '</option>
<option value="1440">', $txt['one_day'], '</option>
<option value="10080">', $txt['one_week'], '</option>
<option value="43200">', $txt['one_month'], '</option>
<option value="-1" selected="selected">', $txt['forever'], '</option>
</select>
<input type="submit" value="', $txt['login'], '" class="button_submit" /><br />
', $txt['quick_login_dec'];

if (!empty($modSettings['enableOpenID']))
echo '
<br />
<input type="text" name="openid_identifier" id="openid_url" size="25" class="input_text openid_login" />';

echo '
<input type="hidden" name="hash_passwrd" value="" />
</form>';
} */

/* if ($context['user']['is_logged'] || !empty($context['show_login_bar']))
echo '
</div>
</div>'; */



echo '

</div>';

// Define the upper_section toggle in JavaScript.
/* echo '
<script type="text/javascript"><!-- // --><![CDATA[
var oMainHeaderToggle = new smc_Toggle({
bToggleEnabled: true,
bCurrentlyCollapsed: ', empty($options['collapse_header']) ? 'false' : 'true', ',
aSwappableContainers: [
\'user_section\',
\'news_section\'
],
aSwapImages: [
{
sId: \'upshrink\',
srcExpanded: smf_images_url + \'/upshrink.gif\',
altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ',
srcCollapsed: smf_images_url + \'/upshrink2.gif\',
altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), '
}
],
oThemeOptions: {
bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
sOptionName: \'collapse_header\',
sSessionVar: ', JavaScriptEscape($context['session_var']), ',
sSessionId: ', JavaScriptEscape($context['session_id']), '
},
oCookieOptions: {
bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
sCookieName: \'upshrink\'
}
});
// ]]></script>'; */

// Show the menu here, according to the menu sub template.
template_menu();

// Show the navigation tree.
if ($context['user']['is_logged'])
{
theme_linktree();
}
else
echo '
<table><tr><td height="50">&nbsp;</td></tr></table>';

          // PM, Open Mod Reports, and New Member noitification bar.
if((!empty($context['user']['unread_messages'])) || (!empty($context['unapproved_members'])) || (!empty($context['open_mod_reports']) && $context['show_open_reports']))
{  
echo '<br /><br /><div class="categoryframe tborder" style="width: 30%; text-align: left; margin: auto;"><h3 class="catbgpm headerpadding"><center>';
if(!empty($context['user']['unread_messages']))
echo '
<a class="notify" href="', $scripturl, '?action=pm">', $txt['you_have'],'  ', $context['user']['unread_messages'], ' ', $context['user']['unread_messages'] == 1 ? $txt['newmessages0'] : $txt['newmessages1'] , '.</a><br />';
if (!empty($context['unapproved_members']))
echo '
<a class="notify" href="', $scripturl, '?action=admin;area=viewmembers;sa=browse;type=approve">', $context['unapproved_members'] == 1 ? $txt['approve_thereis'] : $txt['approve_thereare'], ' ', $context['unapproved_members'],' ', $context['unapproved_members'] == 1 ? $txt['approve_member'] :  $txt['approve_members'], '</a><br />';
if(!empty($context['open_mod_reports']) && $context['show_open_reports'])
echo '
<a class="notify" href="', $scripturl, '?action=moderate;area=reports">', $context['open_mod_reports'] == 1 ? $txt['approve_thereis'] : $txt['approve_thereare'], ' ', $context['open_mod_reports'],' ', $context['open_mod_reports'] == 1 ? $txt['open_moderatorreport'] : $txt['open_moderatorreports'], '</a><br>';
echo '</center></h3></div><br><br>';
}

// The main content should go here.
echo '
<div id="bodyarea">';
}


kat

The real error could be being masked by that "eval" crap.

Can you install and enable this mod?

http://custom.simplemachines.org/mods/index.php?mod=2054

Then, we might get the real error message.

Zirc

I had to manually install that mod because it says it's not compatible with 2.0 RC3 but it seems to work fine here is the new undefined error code:

http://www.tholeweb.com/test/index.php?action=admin;area=logs;sa=errorlog;desc
8: Undefined index: href
File: ..../test/Themes/BLVader/index.template.php
Line: 511


Here is the code that says is giving the error, I've put a comment in where line 511 is.

function template_menu_sub_buttons($button)
{
// any subbuttons then?
if(!empty($button['sub_buttons']))
{
echo '
<ul>';
foreach ($button['sub_buttons'] as $sbutton)
{
echo '
<li>
// This is line 511 --> <a', ((empty($sbutton['active_button'])) ? '' : ' class="active"'), ' href="', $sbutton['href'], '"', ((isset($sbutton['target'])) ? (' target="' . $sbutton['target'] . '"') : ''), '>
<span', ((isset($sbutton['is_last'])) ? ' class="last"' : ''), '>', $sbutton['title'], ((empty($sbutton['sub_buttons'])) ? '' : '...'), '</span>
</a>';
template_menu_sub_buttons($sbutton);
echo '
</li>';
}
echo '
</ul>';
}
}


This is from the mod http://custom.simplemachines.org/mods/index.php?mod=2454  I suppose i should contact the author for help huh?


Zirc

I've moved my questions to the mod thread.  I'll mark this one as solved. 

Thanks


Zirc

Just wanted to update on this error that I had, finally figured it out with the help of this thread http://www.simplemachines.org/community/index.php?topic=355276.msg2415717#msg2415717  I didn't have a 'href' set for one of my sub-menu items and I should have had it set as '#' since the link doesn't actually go anywhere yet.  It wasn't a mod bug after all.

Advertisement: