0
Welcome Guest! Login
0 items Join Now

Undefined Index error - rt_utils.php on line 61

    • mashdun's Avatar
    • mashdun
    • Sr. Rocketeer
    • Posts: 119
    • Thanks: 0

    Undefined Index error - rt_utils.php on line 61

    Posted 16 years 3 months ago
    • I have just ftp loaded a modified Terran Tribune template to a website and I am getting this error in all the right side menu items that are linked to articles.

      Website: www.drjubenville.com

      For instance if you click on "The Horseshoe" i get this error:
      Notice: Undefined index: 28 in /homepages/36/d126872635/htdocs/Sport Management/Dr. J/templates/rt_terrantribune_j15/rt_utils.php on line 61

      28 being the menu ID

      line 61 says:
      $pindex = $toplevel[$item->id];

      Anyone know what I should change on this line or how to fix this??
  • Re: Undefined Index error - rt_utils.php on line 61

    Posted 16 years 3 months ago
    • Hello,

      This error appears because of your PHP error reporting settings. Usually, it appears when your variable is not properly set. There are two ways to handle this issue:

      1. Check if $_POST is set before using it. For example:
      if (!isset($_POST['action']))
      {
      //If not isset -> set with dumy value
      $_POST['action'] = "undefine";
      }

      2. Suppress Notice warnings

      Notice warnings could be suppressed by changing the error_reporting variable in your PHP.ini. error_reporting could be set to show all errors except those for notices and coding standards warnings: error_reporting = E_ALL & ~E_NOTICE

      The same is accomplished by adding the following line in your php page:
      <?php error_reporting (E_ALL ^ E_NOTICE); ?>

      You could also change the error reporting value in your php.ini

      or use the following in the .htaccess file (if your server allows that):

      Code:
      php_flag display_errors on
      php_value error_reporting 6135
    • mashdun's Avatar
    • mashdun
    • Sr. Rocketeer
    • Posts: 119
    • Thanks: 0

    Re: Undefined Index error - rt_utils.php on line 61

    Posted 16 years 3 months ago
    • Thanks Mike for the help!

      Unfortunately I know very little about PHP, actually started taking a course on it yesterday but still new to me. Tried changing the .htaccess but server wouldn't let me.

      In the first option, would i add that code after the line 61 code in the rt_utils.php? I tried this but doesn't work.
       
      61    $pindex = $toplevel[$item->id];
      62    if (!isset($_POST['action']))
      63    {
      64    //If not isset -> set with dumy value
      65    $_POST['action'] = "undefine";
      66    }

      The second option looks simple, just don't know what php page to add to (and what line to add it to) ? Also, where is the php.ini file. I could only find the params.ini

      Thanks again for your help!

      Matt
    • mashdun's Avatar
    • mashdun
    • Sr. Rocketeer
    • Posts: 119
    • Thanks: 0

    Re: Undefined Index error - rt_utils.php on line 61

    Posted 16 years 3 months ago
    • Ok figured it out. In rt_utils.php add this on line 3

      1. <?php
      2. defined( '_JEXEC' ) or die( 'Restricted index access' );
      3. error_reporting (E_ALL ^ E_NOTICE); <
      added this line
      4.
      5. global $Itemid, $modules_list;
      6. $menu_color = $default_color;

Time to create page: 0.055 seconds