SimplePortal

Support => English Support => Topic started by: bluesinjid on May 20, 2009, 08:35:44 PM

Title: I have errors in my error log.
Post 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

Code: [Select]

/****/forum/Themes/default/SPortal2.template.php (body_above sub template - eval?)
Line: 341

and line: 339

and 330

Title: Re: I have errors in my error log.
Post by: ccbtimewiz on May 20, 2009, 08:58:35 PM
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:

Code: [Select]
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:

Code: [Select]
DELETE FROM smf_settings WHERE variable = 'disableTemplateEval';
Title: Re: I have errors in my error log.
Post by: bluesinjid on May 20, 2009, 09:43:50 PM
alright seems to me its at my custom theme and regarding another mod, ajax chat!!!
Code: [Select]
File: /***/forum/Themes/Prof/index.template.php
Line: 330

The exact bad code is ==>330:     

   

   

if ($modSettings['enableChatBelowPM']){
Title: Re: I have errors in my error log.
Post by: ccbtimewiz on May 20, 2009, 09:50:51 PM
Replace it with;

if (isset($modSettings['enableChatBelowPM'])) {
Title: Re: I have errors in my error log.
Post by: Nathaniel on May 21, 2009, 01:41:37 AM
This code would work better, as it checks that the variable exists, and it checks its value as well. ;)
Code: [Select]
if (!empty($modSettings['enableChatBelowPM'])) {
Title: Re: I have errors in my error log.
Post by: ccbtimewiz on May 21, 2009, 11:39:18 AM
Touché. :P
Title: Re: I have errors in my error log.
Post by: bluesinjid on May 21, 2009, 09:36:14 PM
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''
Code: [Select]

<span>', $button['title'], '</span>


Code: [Select]
: Undefined index: href
File: /////////forum/Themes/Prof/index.template.php
Line: 382

   

Code: [Select]
<a title="', $act, '" href="', $button['href'], '">

And just ofr reference heres the code around it

Code: [Select]
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]

Title: Re: I have errors in my error log.
Post by: ccbtimewiz on May 21, 2009, 09:56:16 PM
That's... weird. What does your Subs.php look like?
Title: Re: I have errors in my error log.
Post by: Chit-Chat ChatterBox Boss on May 22, 2009, 02:17:47 PM
I have this same problem.

Just found these 2 errors.

Code: [Select]
Undefined index: title
Apply Filter: Only show the errors from this file
File: /home/XXXXXX/public_html/Themes/default/index.template.php
Line: 643

Code: [Select]
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
Code: [Select]
// 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
Code: [Select]
            <a title="', $act, '" href="', $button['href'], '">
Line 643
Code: [Select]
               <span>', ($button['active_button'] ? '<em>' : ''), $button['title'], ($button['active_button'] ? '</em>' : ''), '</span>
Title: Re: I have errors in my error log.
Post by: ccbtimewiz on May 22, 2009, 02:43:16 PM
Well, here's a temp fix for you...

Code: [Select]
// 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>';
}
Title: Re: I have errors in my error log.
Post by: Chit-Chat ChatterBox Boss on May 22, 2009, 02:47:39 PM
Well, here's a temp fix for you...

Code: [Select]
// 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?
Title: Re: I have errors in my error log.
Post by: ccbtimewiz on May 22, 2009, 02:50:49 PM
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.
Title: Re: I have errors in my error log.
Post by: Chit-Chat ChatterBox Boss on May 22, 2009, 02:53:34 PM
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 ;)
Title: Re: I have errors in my error log.
Post by: bluesinjid on May 22, 2009, 04:28:32 PM
is this code for me too?
Title: Re: I have errors in my error log.
Post by: Chit-Chat ChatterBox Boss on May 22, 2009, 04:31:17 PM
I would say so seeing we have the same code and same problem.
Title: Re: I have errors in my error log.
Post by: Nathaniel on May 23, 2009, 10:13:30 PM
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.
Title: Re: I have errors in my error log.
Post by: bluesinjid on May 27, 2009, 06:10:25 PM
 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
Code: [Select]

<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>';
Title: Re: I have errors in my error log.
Post by: [SiNaN] on May 31, 2009, 05:23:52 AM
Is is just when you view a topic? Can you attach your Display.php and Display.template.php files here?
Title: Re: I have errors in my error log.
Post by: bluesinjid on May 31, 2009, 09:34:35 AM
Yes this is when i view in a topic becasue i have simple portal in a side bar ive included my files
Title: Re: I have errors in my error log.
Post by: [SiNaN] on June 02, 2009, 06:41:55 AM
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

Code: (Find) [Select]
if (!empty($button['sub_buttons']))
Code: (Replace) [Select]
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.
Title: Re: I have errors in my error log.
Post by: bluesinjid on June 02, 2009, 05:22:52 PM
Ah!!! I see the error

Problem: Array
(
    [active_button] => 1
)


How do I disable the active button, I do not want it
Title: Re: I have errors in my error log.
Post by: [SiNaN] on June 03, 2009, 06:13:24 AM
Subs.php

Code: (Find) [Select]
'Forum' => array(
Code: (Replace) [Select]
'forum' => array(
SimplePortal 2.3.8 © 2008-2024, SimplePortal