Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: tipps on August 20, 2015, 08:20:43 AM

Title: Undefined variable: buttons and main sub template - eval? Help please
Post by: tipps on August 20, 2015, 08:20:43 AM
Hello,

I am getting this error in these lines but I can't find the problem, please help?

It's running  SMF 2010

Quote
8: Undefined variable: buttons

/Themes/default/BoardIndex.template.php (main sub template - eval?)
Line: 546 

Quote
8: Undefined variable: buttons

/Themes/default/GenericControls.template.php (main sub template - eval?)
Line: 546
Title: Re: Undefined variable: buttons and main sub template - eval? Help please
Post by: Illori on August 20, 2015, 08:53:06 AM
in the admin panel -> server settings can you disable template eval and post any new errors without eval in them?
Title: Re: Undefined variable: buttons and main sub template - eval? Help please
Post by: tipps on August 20, 2015, 06:12:02 PM
Thank you Illori,

That seemed to fix the default template issue but now I am getting it on my main template.

Quote
8: Undefined variable: buttons

File: /Themes/redsy/index.template.php
Line: 560

Here are the lines it seems to be saying is there is a error in.
// Make the last one, as easy as possible.
$buttons[count($buttons) - 1] = str_replace('<span>', '<span class="last">', $buttons[count($buttons) - 1]);

echo '
<div class="buttonlist', !empty($direction) ? ' float' . $direction : '', '"', (empty($buttons) ? ' style="display: none;"' : ''), (!empty($strip_options['id']) ? ' id="' . $strip_options['id'] . '"': ''), '>
<ul class="nav nav-pills">',
implode('', $buttons), '
</ul>
</div>';

Title: Re: Undefined variable: buttons and main sub template - eval? Help please
Post by: Kindred on August 20, 2015, 06:30:49 PM
Yep, it was almost certainly going to be in that location. There is nothing wrong with that code...   the issue is with the button array -- it looks like a mod was poorly coded and is trying to load buttons when they are not defined.
what mods do you have installed?
Title: Re: Undefined variable: buttons and main sub template - eval? Help please
Post by: tipps on August 20, 2015, 07:02:29 PM
Hi Kindred,

Thanks for that, I think I just found the issue, some code was missing more than likely caused by me.
So I opened the original file and copied that section of the script to the bottom and I see the missing buttons now.

All the page buttons were missing and I didn't even notice  :-[ and now they are all back.

Thanks for your help guys.