Urgent help needed in php .

Discussion in 'Content Management' started by pradipkeya, Jul 27, 2009.

  1. #1
    Hi,

    Any body can help me it's urgent i am getting an error in my site when i am clicking to few article page in the aboe of the site.

    error is



    Warning: Invalid argument supplied for foreach() in /home/itcsliveprojects/itcsprojects/oxygenlight/portal/libraries/joomla/application/menu.php on line 215

    Warning: Invalid argument supplied for foreach() in /home/itcsliveprojects/itcsprojects/oxygenlight/portal/components/com_content/helpers/route.php on line 106

    Warning: Invalid argument supplied for foreach() in /home/itcsliveprojects/itcsprojects/oxygenlight/portal/components/com_content/helpers/route.php on line 106

    Warning: Invalid argument supplied for foreach() in /home/itcsliveprojects/itcsprojects/oxygenlight/portal/components/com_content/helpers/route.php on line 106

    Warning: Invalid argument supplied for foreach() in /home/itcsliveprojects/itcsprojects/oxygenlight/portal/libraries/joomla/application/menu.php on line 215

    Warning: Invalid argument supplied for foreach() in /home/itcsliveprojects/itcsprojects/oxygenlight/portal/components/com_content/helpers/route.php on line 106

    Warning: Invalid argument supplied for foreach() in /home/itcsliveprojects/itcsprojects/oxygenlight/portal/components/com_content/helpers/route.php on line 106

    Warning: Invalid argument supplied for foreach() in /home/itcsliveprojects/itcsprojects/oxygenlight/portal/components/com_content/helpers/route.php on line 106

    Warning: Invalid argument supplied for foreach() in /home/itcsliveprojects/itcsprojects/oxygenlight/portal/libraries/joomla/application/menu.php on line 215

    Warning: Invalid argument supplied for foreach() in /home/itcsliveprojects/itcsprojects/oxygenlight/portal/components/com_content/helpers/route.php on line 106

    Warning: Invalid argument supplied for foreach() in /home/itcsliveprojects/itcsprojects/oxygenlight/portal/components/com_content/helpers/route.php on line 106

    Warning: Invalid argument supplied for foreach() in /home/itcsliveprojects/itcsprojects/oxygenlight/portal/components/com_content/helpers/route.php on line 106

    the link where i am getting the error are :

    http://projects.itcslive.com/oxygenl...ighter&lang=en

    Regards
    Pradip
     
    pradipkeya, Jul 27, 2009 IP
  2. pradipkeya

    pradipkeya Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Here is the code of menu.php

    <?php
    /**
    * @version $Id: menu.php 10707 2008-08-21 09:52:47Z eddieajau $
    * @package Joomla.Framework
    * @subpackage Application
    * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
    * @license GNU/GPL, see LICENSE.php
    * Joomla! is free software. This version may have been modified pursuant
    * to the GNU General Public License, and as distributed it includes or
    * is derivative of works licensed under the GNU General Public License or
    * other free or open source software licenses.
    * See COPYRIGHT.php for copyright notices and details.
    */

    // Check to ensure this file is within the rest of the framework
    defined('JPATH_BASE') or die();

    /**
    * JMenu class
    *
    * @package Joomla.Framework
    * @subpackage Application
    * @since 1.5
    */
    class JMenu extends JObject
    {
    /**
    * Array to hold the menu items
    *
    * @access private
    * @param array
    */
    var $_items = array ();

    /**
    * Identifier of the default menu item
    *
    * @access private
    * @param integer
    */
    var $_default = 0;

    /**
    * Identifier of the active menu item
    *
    * @access private
    * @param integer
    */
    var $_active = 0;


    /**
    * Class constructor
    *
    * @access public
    * @return boolean True on success
    */
    function __construct($options = array())
    {
    $this->load(); //load the menu items

    foreach ($this->_items as $k => $item)
    {
    if ($item->home) {
    $this->_default = $item->id;
    }
    }
    }

    /**
    * Returns a reference to a JMenu object
    *
    * This method must be invoked as:
    * <pre> $menu = &JSite::getMenu();</pre>
    *
    * @access public
    * @param string $client The name of the client
    * @param array $options An associative array of options
    * @return JMenu A menu object.
    * @since 1.5
    */
    function &getInstance($client, $options = array())
    {
    static $instances;

    if (!isset( $instances )) {
    $instances = array();
    }

    if (empty($instances[$client]))
    {
    //Load the router object
    $info =& JApplicationHelper::getClientInfo($client, true);

    $path = $info->path.DS.'includes'.DS.'menu.php';
    if(file_exists($path))
    {
    require_once $path;

    // Create a JPathway object
    $classname = 'JMenu'.ucfirst($client);
    $instance = new $classname($options);
    }
    else
    {
    //$error = JError::raiseError( 500, 'Unable to load menu: '.$client);
    $error = null; //Jinx : need to fix this
    return $error;
    }

    $instances[$client] = & $instance;
    }

    return $instances[$client];
    }

    /**
    * Get menu item by id
    *
    * @access public
    * @param int The item id
    * @return mixed The item object, or null if not found
    */
    function &getItem($id)
    {
    $result = null;
    if (isset($this->_items[$id])) {
    $result = &$this->_items[$id];
    }

    return $result;
    }

    /**
    * Set the default item by id
    *
    * @param int The item id
    * @access public
    * @return True, if succesfull
    */
    function setDefault($id)
    {
    if(isset($this->_items[$id])) {
    $this->_default = $id;
    return true;
    }

    return false;
    }

    /**
    * Get menu item by id
    *
    * @access public
    *
    * @return object The item object
    */
    function &getDefault()
    {
    $item =& $this->_items[$this->_default];
    return $item;
    }

    /**
    * Set the default item by id
    *
    * @param int The item id
    * @access public
    * @return If successfull the active item, otherwise null
    */
    function &setActive($id)
    {
    if(isset($this->_items[$id]))
    {
    $this->_active = $id;
    $result = &$this->_items[$id];
    return $result;
    }

    $result = null;
    return $result;
    }

    /**
    * Get menu item by id
    *
    * @access public
    *
    * @return object The item object
    */
    function &getActive()
    {
    if ($this->_active) {
    $item =& $this->_items[$this->_active];
    return $item;
    }

    $result = null;
    return $result;
    }

    /**
    * Gets menu items by attribute
    *
    * @access public
    * @param string The field name
    * @param string The value of the field
    * @param boolean If true, only returns the first item found
    * @return array
    */
    function getItems($attribute, $value, $firstonly = false)
    {
    $items = null;

    foreach ($this->_items as $item)
    {
    if ( ! is_object($item) )
    continue;

    if ($item->$attribute == $value)
    {
    if($firstonly) {
    return $item;
    }

    $items[] = $item;
    }
    }

    return $items;
    }

    /**
    * Gets the parameter object for a certain menu item
    *
    * @access public
    * @param int The item id
    * @return object A JParameter object
    */
    function &getParams($id)
    {
    $ini = '';
    if ($menu =& $this->getItem($id)) {
    $ini = $menu->params;
    }
    $result = new JParameter( $ini );

    return $result;
    }

    /**
    * Getter for the menu array
    *
    * @access public
    * @param string $name The menu name
    * @return array
    */
    function getMenu() {
    return $this->_items;
    }

    /**
    * Method to check JMenu object authorization against an access control
    * object and optionally an access extension object
    *
    * @access public
    * @param integer $id The menu id
    * @param integer $accessid The users access identifier
    * @return boolean True if authorized
    */
    function authorize($id, $accessid = 0)
    {
    $menu =& $this->getItem($id);
    return ((isset($menu->access) ? $menu->access : 0) <= $accessid);
    }

    /**
    * Loads the menu items
    *
    * @abstract
    * @access public
    * @return array
    */
    function load()
    {
    return array();
    }
    }
     
    pradipkeya, Jul 27, 2009 IP
  3. pradipkeya

    pradipkeya Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Here is the code for route.php

    <?php
    /**
    * @version $Id: route.php 11190 2008-10-20 00:49:55Z ian $
    * @package Joomla
    * @subpackage Content
    * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
    * @license GNU/GPL, see LICENSE.php
    * Joomla! is free software. This version may have been modified pursuant to the
    * GNU General Public License, and as distributed it includes or is derivative
    * of works licensed under the GNU General Public License or other free or open
    * source software licenses. See COPYRIGHT.php for copyright notices and
    * details.
    */

    // no direct access
    defined('_JEXEC') or die('Restricted access');

    // Component Helper
    jimport('joomla.application.component.helper');

    /**
    * Content Component Route Helper
    *
    * @static
    * @package Joomla
    * @subpackage Content
    * @since 1.5
    */
    class ContentHelperRoute
    {
    /**
    * @param int The route of the content item
    */
    function getArticleRoute($id, $catid = 0, $sectionid = 0)
    {
    $needles = array(
    'article' => (int) $id,
    'category' => (int) $catid,
    'section' => (int) $sectionid,
    );

    //Create the link
    $link = 'index.php?option=com_content&view=article&id='. $id;

    if($catid) {
    $link .= '&catid='.$catid;
    }

    if($item = ContentHelperRoute::_findItem($needles)) {
    $link .= '&Itemid='.$item->id;
    };

    return $link;
    }

    function getSectionRoute($sectionid)
    {
    $needles = array(
    'section' => (int) $sectionid
    );

    //Create the link
    $link = 'index.php?option=com_content&view=section&id='.$sectionid;

    if($item = ContentHelperRoute::_findItem($needles)) {
    if(isset($item->query['layout'])) {
    $link .= '&layout='.$item->query['layout'];
    }
    $link .= '&Itemid='.$item->id;
    };

    return $link;
    }

    function getCategoryRoute($catid, $sectionid)
    {
    $needles = array(
    'category' => (int) $catid,
    'section' => (int) $sectionid
    );

    //Create the link
    $link = 'index.php?option=com_content&view=category&id='.$catid;

    if($item = ContentHelperRoute::_findItem($needles)) {
    if(isset($item->query['layout'])) {
    $link .= '&layout='.$item->query['layout'];
    }
    $link .= '&Itemid='.$item->id;
    };

    return $link;
    }

    function _findItem($needles)
    {
    $component =& JComponentHelper::getComponent('com_content');

    $menus = &JApplication::getMenu('site', array());
    $items = $menus->getItems('componentid', $component->id);

    $match = null;

    foreach($needles as $needle => $id)
    {
    foreach($items as $item)
    {
    if ((@$item->query['view'] == $needle) && (@$item->query['id'] == $id)) {
    $match = $item;
    break;
    }
    }

    if(isset($match)) {
    break;
    }
    }

    return $match;
    }
    }
    ?>
     
    pradipkeya, Jul 27, 2009 IP
  4. shanlee

    shanlee Peon

    Messages:
    56
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    i am surprised no DP member come to help you out. I am not the one who can help you. some one soon listen to you.
     
    shanlee, Jul 27, 2009 IP
  5. Rodder7

    Rodder7 Active Member

    Messages:
    451
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    88
    #5
    just a suggestion. check your sef components. deactivate them and turn off sef in global config(all off). then try the links again.
     
    Rodder7, Jul 27, 2009 IP
  6. pradipkeya

    pradipkeya Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Is there ant DP member who can help me out regarding this error.
     
    pradipkeya, Jul 31, 2009 IP