Foros del Web » Programando para Internet » PHP »

Warning: Invalid argument supplied for foreach() in

Estas en el tema de Warning: Invalid argument supplied for foreach() in en el foro de PHP en Foros del Web. Warning: Invalid argument supplied for foreach() in /home/imvu360/public_html/index.html/components/com_content/helpers/route.php on line 106 -> line 205: { -> line 106: foreach($items as $item) Hola, me gustaria saber ...
  #1 (permalink)  
Antiguo 03/07/2009, 10:29
 
Fecha de Ingreso: julio-2009
Mensajes: 14
Antigüedad: 14 años, 10 meses
Puntos: 0
Exclamación Warning: Invalid argument supplied for foreach() in

Warning: Invalid argument supplied for foreach() in /home/imvu360/public_html/index.html/components/com_content/helpers/route.php on line 106


-> line 205: {
-> line 106: foreach($items as $item)

Hola, me gustaria saber que hay de malo en ese codigo, yo nunca lo modifique y si estaba funcionando , hoy entre a la web y empezo a aparecer ese error, alguien me puede ayudar porfavor?
  #2 (permalink)  
Antiguo 03/07/2009, 10:31
Avatar de acoevil  
Fecha de Ingreso: julio-2008
Ubicación: localhost/colombia/sevillaValle.php
Mensajes: 1.123
Antigüedad: 15 años, 9 meses
Puntos: 32
Respuesta: Warning: Invalid argument supplied for foreach() in

Quizas $items este mal, pon el codigo
  #3 (permalink)  
Antiguo 03/07/2009, 10:33
 
Fecha de Ingreso: julio-2009
Mensajes: 14
Antigüedad: 14 años, 10 meses
Puntos: 0
Respuesta: Warning: Invalid argument supplied for foreach() in

<?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='.$s ectionid;

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;
}
}
?>
  #4 (permalink)  
Antiguo 03/07/2009, 10:43
Avatar de acoevil  
Fecha de Ingreso: julio-2008
Ubicación: localhost/colombia/sevillaValle.php
Mensajes: 1.123
Antigüedad: 15 años, 9 meses
Puntos: 32
Respuesta: Warning: Invalid argument supplied for foreach() in

Mira donde dice

.$s ectionid; debe ser pegada asi $sectionid;

Aqui tambien

.$ catid;
  #5 (permalink)  
Antiguo 03/07/2009, 11:07
 
Fecha de Ingreso: julio-2009
Mensajes: 14
Antigüedad: 14 años, 10 meses
Puntos: 0
Respuesta: Warning: Invalid argument supplied for foreach() in

Primero que todo gracias por la ayuda, la necesito enserio.

Segundo en que linea estan esos codigos que yo miro todos esos codigos juntos.
  #6 (permalink)  
Antiguo 03/07/2009, 11:10
 
Fecha de Ingreso: julio-2009
Mensajes: 14
Antigüedad: 14 años, 10 meses
Puntos: 0
Respuesta: Warning: Invalid argument supplied for foreach() in

Ya lo encontre, en el codigo si esta pegado, no se porque aqui aparecio separado .

Que podria ser lo que me esta dando ese error?
  #7 (permalink)  
Antiguo 03/07/2009, 13:18
Avatar de DooBie  
Fecha de Ingreso: septiembre-2004
Mensajes: 1.101
Antigüedad: 19 años, 7 meses
Puntos: 71
Respuesta: Warning: Invalid argument supplied for foreach() in

Yo creo que es un problema de { y } alguno te falta o sobra.... revisalo.
  #8 (permalink)  
Antiguo 03/07/2009, 13:53
Avatar de anf
anf
 
Fecha de Ingreso: junio-2009
Mensajes: 30
Antigüedad: 14 años, 10 meses
Puntos: 4
Respuesta: Warning: Invalid argument supplied for foreach() in

Código PHP:
if ($item ContentHelperRoute::_findItem($needles)) {
if (isset(
$item->query['layout'])) { $link .= '&layout='.$item->query['layout']; }
$link .= '&Itemid='.$item->id;
}; 
/* <- Aquí no sobra ;? Pregunto. */

$match null; { /* <- Y este bracket ? */
    
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
Hay cosas que no entiendo, esto esta bien }; ?
  #9 (permalink)  
Antiguo 03/07/2009, 14:44
 
Fecha de Ingreso: julio-2009
Mensajes: 14
Antigüedad: 14 años, 10 meses
Puntos: 0
Respuesta: Warning: Invalid argument supplied for foreach() in

Miren, ese codigo yo no lo hice, ya lo traia la instalacion de Joomla 1.5 y estaba todo funcionando muy bien, hoy instale un nuevo template en la pagina y empezo a salir ese error.

Yo pienso que el codigo esta bien porque nadie lo ha modificado , viene default.

No puede ser que el problema este en otro archivo o algo?
Ayudenme porfavor
  #10 (permalink)  
Antiguo 03/07/2009, 14:51
 
Fecha de Ingreso: julio-2009
Mensajes: 14
Antigüedad: 14 años, 10 meses
Puntos: 0
Respuesta: Warning: Invalid argument supplied for foreach() in

Ahorita que revise el ftp , abri un documento llamado "error_log" que estaba en public_html/index.html y vi que alli estan los errores, aparece de la siguiente manera:

[03-jul-2009 15:49:52] PHP Warning: Invalid argument supplied for foreach() in /home/imvu360/public_html/index.html/components/com_content/helpers/route.php on line 106
[03-jul-2009 15:49:52] PHP Warning: Invalid argument supplied for foreach() in /home/imvu360/public_html/index.html/components/com_content/helpers/route.php on line 106
[03-jul-2009 15:49:52] PHP Warning: Invalid argument supplied for foreach() in /home/imvu360/public_html/index.html/components/com_content/helpers/route.php on line 106
[03-jul-2009 15:49:52] PHP Warning: Invalid argument supplied for foreach() in /home/imvu360/public_html/index.html/components/com_content/helpers/route.php on line 106

... Elimine la carpeta del ftp pero continua saliendo, alguna idea?
  #11 (permalink)  
Antiguo 03/07/2009, 15:13
Avatar de trasgukabi  
Fecha de Ingreso: septiembre-2004
Mensajes: 2.749
Antigüedad: 19 años, 8 meses
Puntos: 18
Respuesta: Warning: Invalid argument supplied for foreach() in

esas dos cosas ; y { te sobran.

Y no tengáis miedo de probar a borrar alguna linea del programa, que el servidor no va a explotar. Y, afortunadamente, existe el CTRL+Z, jeje (Por fin es viernes!!)
  #12 (permalink)  
Antiguo 03/07/2009, 19:17
 
Fecha de Ingreso: julio-2009
Mensajes: 14
Antigüedad: 14 años, 10 meses
Puntos: 0
Respuesta: Warning: Invalid argument supplied for foreach() in

Gracias a todos.

Elimine: foreach($items as $item)

Y se compuse, muchisimas gracias por todo.
Bye
  #13 (permalink)  
Antiguo 05/07/2009, 04:43
Avatar de anf
anf
 
Fecha de Ingreso: junio-2009
Mensajes: 30
Antigüedad: 14 años, 10 meses
Puntos: 4
Exclamación Respuesta: Warning: Invalid argument supplied for foreach() in

Cita:
Iniciado por trasgukabi Ver Mensaje
esas dos cosas ; y { te sobran.

Y no tengáis miedo de probar a borrar alguna linea del programa, que el servidor no va a explotar. Y, afortunadamente, existe el CTRL+Z, jeje (Por fin es viernes!!)
Estaba casi 99% seguro pero como es una instalación de joomla pensé que cientos de usuarios que la revisan y la diseñan sabrían mucho mas que yo solo, por eso queria confirmarlo, veo que tiene que ser un copy paste de los malos por que efectivamente no pinta nada ahí un bracket y un punto y coma tipo Javascript, quizá el motor php lo procese y se lo salte por alguna extraña razón, o provoque solamente un warning y tenga deshabilitados nos notices y demás.

Cita:
Iniciado por _BigBull_ Ver Mensaje
Gracias a todos.

Elimine: foreach($items as $item)

Y se compuse, muchisimas gracias por todo.
Bye
Si eliminas el foreach seguramente alguna función a la hora de llamarla no sabrá en que item esta tu página, tema, noticia, post, comentario o algo asi, no puedes borrar así como así parte del core de joomla, lo que esta mal es el template no el core.

Ya nos cuentas.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:04.