SimplePortal
Support => English Support => Topic started by: bluesinjid on May 20, 2009, 08:35:44 PM
-
I use simple portal 2.2.1 and smf 2.0 rc1
Hi I get about 3 errors related to my site
/****/forum/Themes/default/SPortal2.template.php (body_above sub template - eval?)
Line: 341
and line: 339
and 330
-
What other mods do you have installed? Could you disable eval()?
To disable eval(), open phpMyAdmin and click the SQL tab and use the following query:
REPLACE INTO smf_settings VALUES ('disableTemplateEval', 1);
By disabling eval(), the errors that have already occurred need to be propagated once again. The new errors that have appeared in the error log contain the correct file that PHP had a problem with.
To reactivate eval(), use the following query:
DELETE FROM smf_settings WHERE variable = 'disableTemplateEval';
-
alright seems to me its at my custom theme and regarding another mod, ajax chat!!!
File: /***/forum/Themes/Prof/index.template.php
Line: 330
The exact bad code is ==>330:
if ($modSettings['enableChatBelowPM']){
-
Replace it with;
if (isset($modSettings['enableChatBelowPM'])) {
-
This code would work better, as it checks that the variable exists, and it checks its value as well. ;)
if (!empty($modSettings['enableChatBelowPM'])) {
-
Touché. :P
-
k thanks for that that part of the error is fixed :)
NOw i get and error when ever you visit a topic
/------/forum/Themes/Prof/index.template.php
This is the code undefined ''title''
<span>', $button['title'], '</span>
: Undefined index: href
File: /////////forum/Themes/Prof/index.template.php
Line: 382
<a title="', $act, '" href="', $button['href'], '">
And just ofr reference heres the code around it
362: // Show the menu up top. Something like [home] [help] [profile] [logout]...
363: function template_menu()
364: {
365:
global $context, $settings, $options, $scripturl, $txt, $modSettings;
366:
367:
echo '
368:
<div id="main_menu">
369:
<ul class="clearfix">';
370:
371:
foreach ($context['menu_buttons'] as $act => $button)
372:
{
373:
$classes = array();
374:
if (!empty($button['active_button']))
375:
$classes[] = 'active';
376:
if (!empty($button['is_last']))
377:
$classes[] = 'last';
378:
$classes = implode(' ', $classes);
379:
380:
echo '
381:
<li id="button_', $act, '"', !empty($classes) ? ' class="' . $classes . '"' : '', '>
==>382:
<a title="', $act, '" href="', $button['href'], '">
383:
<span>', $button['title'], '</span>
384:
</a>
385:
</li>';
386:
}
387:
388:
echo '
389:
</ul>
390:
</div>';
391: }
392:
393: // Generate a strip of buttons.
394: function template_button_strip($button_strip, $direction = 'top', $custom_td = '')
395: {
396:
global $settings, $context, $txt, $scripturl;
397:
398:
// Create the buttons...
399:
$buttons = array();
400:
foreach ($button_strip as $key => $value)
401:
if (!isset($value['test']) || !empty($context[$value['test']]))
402:
$buttons[] = '<a href="' . $value['url'] . '"' . (isset($value['active']) ? ' class="active"' : '') . (isset($value['custom']) ? ' ' . $value['custom'] : '') . '><span>' . $txt[$value['text']] . '</span></a>';
/code]
-
That's... weird. What does your Subs.php look like?
-
I have this same problem.
Just found these 2 errors.
Undefined index: title
Apply Filter: Only show the errors from this file
File: /home/XXXXXX/public_html/Themes/default/index.template.php
Line: 643
Undefined index: href
Apply Filter: Only show the errors from this file
File: /home/XXXXXX/public_html/Themes/default/index.template.php
Line: 642
Area that contains line 642 & 643
// Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
echo '
<div id="main_menu">
<ul class="clearfix">';
foreach ($context['menu_buttons'] as $act => $button)
{
$classes = array();
if (!empty($button['active_button']))
$classes[] = 'active';
if (!empty($button['is_last']))
$classes[] = 'last';
$classes = implode(' ', $classes);
echo '
<li id="button_', $act, '"', !empty($classes) ? ' class="' . $classes . '"' : '', '>
<a title="', $act, '" href="', $button['href'], '">
<span>', ($button['active_button'] ? '<em>' : ''), $button['title'], ($button['active_button'] ? '</em>' : ''), '</span>
</a>
</li>';
}
echo '
</ul>
</div>';
}
Line 642
<a title="', $act, '" href="', $button['href'], '">
Line 643
<span>', ($button['active_button'] ? '<em>' : ''), $button['title'], ($button['active_button'] ? '</em>' : ''), '</span>
-
Well, here's a temp fix for you...
// Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
echo '
<div id="main_menu">
<ul class="clearfix">';
foreach ($context['menu_buttons'] as $act => $button)
{
$classes = array();
if (!empty($button['active_button']))
$classes[] = 'active';
if (!empty($button['is_last']))
$classes[] = 'last';
$classes = implode(' ', $classes);
echo '
<li id="button_', $act, '"', !empty($classes) ? ' class="' . $classes . '"' : '', '>
<a title="', $act, '" href="', (isset($button['href']) ? $button['href'] : ''), '">
<span>', ($button['active_button'] ? '<em>' : ''), (isset($button['title']) ? $button['title'] : ''), ($button['active_button'] ? '</em>' : ''), '</span>
</a>
</li>';
}
echo '
</ul>
</div>';
}
-
Well, here's a temp fix for you...
// Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
echo '
<div id="main_menu">
<ul class="clearfix">';
foreach ($context['menu_buttons'] as $act => $button)
{
$classes = array();
if (!empty($button['active_button']))
$classes[] = 'active';
if (!empty($button['is_last']))
$classes[] = 'last';
$classes = implode(' ', $classes);
echo '
<li id="button_', $act, '"', !empty($classes) ? ' class="' . $classes . '"' : '', '>
<a title="', $act, '" href="', (isset($button['href']) ? $button['href'] : ''), '">
<span>', ($button['active_button'] ? '<em>' : ''), (isset($button['title']) ? $button['title'] : ''), ($button['active_button'] ? '</em>' : ''), '</span>
</a>
</li>';
}
echo '
</ul>
</div>';
}
By temp .. you mean its a get around, not a proper fix? Or it is a good fix?
-
Well, I'm not entirely sure to why those fields are empty in the first place-- it could be some add-on/mod that isn't functioning properly.
I just added checks to the values; so if its empty, it returns empty instead of returning nothing (and if it returned nothing, it would be 'undefined').
It's proper in the scheme of things, but I suspect a deeper issue than this.
-
And it seemed to work..... Nothing was ever broken (as in everything worked fine) just those 2 errors popped up. Now we don't have those 2 errors and everything is working perfect so I will say its a good fix ;)
-
is this code for me too?
-
I would say so seeing we have the same code and same problem.
-
Having a look over these issues, its likely that they are being caused by errors in your Subs.php files, where the context for the SMF 2 menu is setup.
@bluesinjid,
Could you please post your '/Themes/{themename}/index.template.php' and '/sources/Subs.php' files as attachments?
@Chit-Chat ChatterBox Boss,
Could you please post your '/sources/Subs.php' file as an attachment?
That edit posted by ccbtimewiz will stop the errors from showing, although it doesn't resolve the issue that is causing them. If you post your Subs.php file then I can try to get to the bottom of it.
-
Alright heres my files and ive got these errors when i read a post in a topic ....
This is the exact error in
File: /*******/forum/Sources/SPortal2.php
<li>', sp_embed_image('dot'), (!empty($button['sub_buttons']) ? '</a>' : ''), ' <a title="', $button['title'], '" href="', $button['href'], '">', ($button['active_button'] ? '<strong>' : ''), $button['title'], ($button['active_button'] ? '</strong>' : ''), '</a>';
-
Is is just when you view a topic? Can you attach your Display.php and Display.template.php files here?
-
Yes this is when i view in a topic becasue i have simple portal in a side bar ive included my files
-
I'm not really sure what's causing the error but I highly doubt it is related to SimplePortal. Would you add this debugging code and report us what you see?
SPortal2.php
if (!empty($button['sub_buttons']))
if (allowedTo('admin_forum') && (!isset($button['href']) || !isset($button['title'])))
echo '<pre>Problem: '; print_r($button); echo '</pre><br />';
if (!empty($button['sub_buttons']))
Note that only admins will see the debugging code.
-
Ah!!! I see the error
Problem: Array
(
[active_button] => 1
)
How do I disable the active button, I do not want it
-
Subs.php
'Forum' => array(
'forum' => array(