Jump to content

undefined index: task in & Undefined index: layout in


SergeiGrey

Recommended Posts

Hi Guys

 

I need some help please... I get the following error.

 

Notice: Undefined index: layout in /home/wwwitsmf/public_html/components/com_jomdirectory/router.php on line 43

Notice: Undefined index: task in /home/wwwitsmf/public_html/components/com_jomdirectory/router.php on line 39

 

Here is the code:

 

 

    // we need a menu item.  Either the one specified in the query, or the current active one if none specified

    if (empty($query['Itemid'])) {

            $menuItem = $menu->getItems('link','index.php?option=com_jomdirectory&view=homepage&layout=categories.tpl&id=',true);

            $query['Itemid'] = $menuItem->id;

//            print_r($menuItem);

    }

 

line 39:    if(isset($query['task']) & $query['task']!=='detailed')

    {

 

        if($query['task']=='search' ) {

Line43:      if($query['layout']!='latest.tpl' && $query['layout']!='categories.tpl') {

                $segments[] = 'category';

            }

        } else {

            $segments[] = str_replace(' ', '-', $query['task']);

        }

    }

    unset($query['layout']);

    unset($query['task']);

 

// if(isset($query['category']))

// {

// $segments[] = str_replace(' ', '-', $query['category']);

// unset($query['category']);

// }

 

 

Link to comment
Share on other sites

Please use the correct tags for displaying code.

 

if(isset($query['task']) & $query['task']!=='detailed')

 

should be

 

if(isset($query['task']) && $query['task']!=='detailed')

 

check that your array keys are being defined before being used

Link to comment
Share on other sites

Hi

 

Thanks for the reply... sorry for not pasting the code in the correct tags... I am not really a programmer. I don't know how to fix the code because I didn't write it. It is a plugin that I bought for Joomla from Comdev and I have had no joy from the developer and I paid 200 Euro for the plugin.

 

So any assistance in this regards will be highly appreciated.

 

Regards

 

Sergei

 

 

Link to comment
Share on other sites

 // we need a menu item.  Either the one specified in the query, or the current active one if none specified
    if (empty($query['Itemid'])) {
            $menuItem = $menu->getItems('link','index.php?option=com_jomdirectory&view=homepage&layout=categories.tpl&id=',true);
            $query['Itemid'] = $menuItem->id;
//            print_r($menuItem);
    }
   
line 39:    if(isset($query['task']) & $query['task']!=='detailed')
    {

        if($query['task']=='search' ) {
Line43:       if($query['layout']!='latest.tpl' && $query['layout']!='categories.tpl') {
                $segments[] = 'category';
            }
        } else {
            $segments[] = str_replace(' ', '-', $query['task']);
        }
    }
    unset($query['layout']);
    unset($query['task']);
   
//   if(isset($query['category']))
//   {
//   $segments[] = str_replace(' ', '-', $query['category']);
//   unset($query['category']);
//   }

Link to comment
Share on other sites

change

 

if(isset($query['task']) & $query['task']!=='detailed')

 

to

 

if(isset($query['task']) && $query['task']!=='detailed')

 

and

 

if($query['layout']!='latest.tpl' && $query['layout']!='categories.tpl') {

 

to

 

if(isset($query['layout']) && $query['layout']!='latest.tpl' && $query['layout']!='categories.tpl') {

 

Try the code I have given above and see what the results are. I leave no promises that this is going to fix the problem.

 

The problem is that the keys in the array is not being defined and then is being used. You cannot use an array if you do not first define it. There must be somewhere in the script, a part that you have not posted here, where the array is initially created with the two keys that are creating the problem. Make sure they are being set propperly. Also ensure they will be set to a default value such as NULL even if they are to not be used.

 

I recommend you look on google for some basic PHP tutorials before you making any more major changes to the script. However, I would recommend you be careful where you buy your scripts from.

Link to comment
Share on other sites

Whoooooweeee... Mikhl I can't thank you enough it worked like a charm. Thank you so much for your help I didn't know what I was going to say to the customer we are out in South Africa so 200 euros is a considerable amount of money if the you take the Rand to Euro exchange rate into consideration.

 

Thank you... Thank you... Thank you....

 

Regards

 

Sergei

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.