Hello again, I would like to create a config file that contains the hostname and path to the application, so the subsequent Zend_Config invocations can be able to find every other files, even if I move the app to another location.
This is my IndexController.php the commented line (#3) is the file that I wish to include and produces the error: require_once 'Zend/Controller/Action.php'; require_once 'Zend/View.php'; // include_once '/var/www/mauricio/includes/config.php'; class IndexController extends Zend_Controller_Action { public function indexAction() { // Instancia y configura el Zend_View $view = new Zend_View(); $view->addScriptPath('/var/www/mauricio/application/views'); // Asigna las variables del controlador a la vista $view->uniqid = $myvar; // Finalmente hace un render de la vista echo $view->render('header.php'); echo $view->render('index.php'); echo $view->render('footer.php'); } } Pádraic Brady wrote: > > What does the config file included contain exactly? If you can attach the > controller in question I can probably spot anything obvious too. > > Best regards, > Paddy > > > Mauricio Cuenca wrote: >> >> Hello Paddy, >> >> I use Zend_Config in some parts, but in this case I really need to >> include a generic config file. I do not get any error message, just a >> blank page is showed to me. If I comment the line, it works >> automatically. >> >> >> >> Pádraic Brady wrote: >>> >>> Hi Mauricio, >>> >>> What error exactly are you getting? >>> Also are you trying to get the configuration data injected right into an >>> Action, or into an instance of Zend_Config? >>> >>> Including really just appends the include's code into that location - so >>> where you put the include statement is important. Using include files >>> with PHP content as a source for Zend_Config is also covered in the >>> manual - it actually uses require there I believe since the included >>> file can be a simple "return array(..my configuration array...);" as >>> regards content. >>> >>> Best regards, >>> Paddy >>> >>> Mauricio Cuenca wrote: >>>> >>>> Hello, >>>> >>>> I am building a new application and I want to place database stuff and >>>> configuration in one file. But when I include the files in any of the >>>> controller scripts I get an error. >>>> >>>> I am sure the problem is not related to a file not found or a syntax >>>> error, I am doing something like this in IndexController.php: >>>> >>>> /** Zend_Controller_Action */ >>>> require_once 'Zend/Controller/Action.php'; >>>> require_once 'Zend/View.php'; >>>> >>>> include_once 'myconfig.php'; >>>> >>>> Is not allowed to have files at this point? I have to include each one >>>> in each action function. >>>> >>>> Thanks! >>>> >>>> >>>> >>> >>> >> >> > > -- View this message in context: http://www.nabble.com/Using-include_once-tp15333284s16154p15336912.html Sent from the Zend Framework mailing list archive at Nabble.com.