Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/05/2014, 09:47
quico5
 
Fecha de Ingreso: enero-2008
Mensajes: 580
Antigüedad: 16 años, 3 meses
Puntos: 9
Parse error: syntax error, unexpected 'return' (T_RETURN)

¿Qué significa este error del return?

Cita:
Parse error: syntax error, unexpected 'return' (T_RETURN) in
C:\xampp\htdocs\anhida\widgets\menu.php on line 37
---------------------------------

index.phtml
Código PHP:
<?=$widget?>
menu-header.php
Código PHP:
<?php print_r($menu); ?>
indexController.php
Código PHP:
$this->_view->widget('menu''menu'); 
menu.php
Código PHP:
    class menuWidget extends Widget {
        public function 
menu() {
            
$menuHeader['menu'] = array(
                array(
                    
'id' => 'portada',
                    
'titulo' => 'portada',
                    
'enlace' => BASE_URL,
                    
'imagen' => '',
                ),
                array(
                    
'id' => 'diptico',
                    
'titulo' => 'diptico',
                    
'enlace' => BASE_URL.'diptico',
                    
'imagen' => '',
                ),
                array(
                    
'id' => 'test',
                    
'titulo' => 'test',
                    
'enlace' => BASE_URL.'test',
                    
'imagen' => '',
                ),
                array(
                    
'id' => 'comunidad',
                    
'titulo' => 'comunidad',
                    
'enlace' => BASE_URL.'comunidad',
                    
'imagen' => '',
                ),
                array(
                    
'id' => 'noticias',
                    
'titulo' => 'noticias',
                    
'enlace' => BASE_URL.'noticias',
                    
'imagen' => '',
                ),
            )

        return 
$this->render('menu-header' $menuHeader);
        }
    } 
view.php
Código PHP:
    abstract class Widget {
        protected function 
loadModel($model) {
            if (
is_readable(ROOT.'widgets'.DS.'models'.DS.$model.'.php')) {
                include_once 
ROOT.'widgets'.DS.'models'.DS.$model.'.php';

                
$modelClass $model.'Widget';

                if (
class_exists($modelClass)) {
                    return new 
$modelClass;
                }
            }
            throw new 
Exception('Error modelo de widget');
        }

        protected function 
render($view$data = array(), $ext '.phtml') {
            if (
is_readable(ROOT.'widgets'.DS.'views'.DS.$view.'.'.$ext)) {
                
ob_start();
                
extract($data);
                include 
ROOT.'widgets'.DS.'views'.DS.$view.'.'.$ext;
                
$content ob_get_contents();
                
ob_end_clean();
                return 
$content;
            }
            throw new 
Exception('Error vista widget');            
        }
    } 
Código PHP:
        public function widget($widget$method$options = array()) {
            if (!
is_array($options)) {
                
$options = array($options);
            }

            if (
is_readable(ROOT.'widgets'.DS.$widget.'.php')) {
                include_once 
ROOT.'widgets'.DS.$widget.'.php';

                
$widgetClass $widget.'Widget';

                if (!
class_exists($widgetClass)) {
                    throw new 
Exception('Error clase widget');
                }

                if (
is_callable($widgetClass$method)) {
                    if (
count($options)) {
                        return 
call_user_func_array(array(new $widgetClass$method), $options);
                    } else {
                        return 
call_user_func(array(new $widgetClass$method));
                    }
                }
                throw new 
Exception('Error metodo widget');
            }
            throw new 
Exception('Error de widget');
        } 

Última edición por quico5; 15/05/2014 a las 09:54