+ Reply to Thread
Results 1 to 3 of 3

Thread: zend controller front dnt return baseurl in bootstrap ??

  1. #1
    lion21 is offline Junior Member
    Join Date
    Apr 2009
    Posts
    13

    Arrow zend controller front dnt return baseurl in bootstrap ??

    hi all
    in my configs/application.ini
    i hav set base url.

    Code:
    resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
    resources.frontController.setBaseUrl = "/mysite/public"
    but if i tried to access it in /application/bootstrap.php

    by
    $front = Zend_Controller_Front::getInstance();
    echo $front->getBaseUrl(); //it returns empty

    but if do the same thing in my IndexController , i get the base url value.

    can anyone helpe me why this happening ??

  2. #2
    alokin is offline Senior Member
    Join Date
    Apr 2009
    Posts
    192

    Default

    First of all, it's not setBaseUrl, but only baseUrl . And second thing, yeah, you can't access base url in your bootstrap, because
    all resources (including frontController) that you're trying to initialize in your application.ini will be executed during bootstrap process.

    However, you can force bootstrapping of some resource from your Bootstrap class, before the bootstrap method is triggered, by calling it, and supplying name of the resource you want to bootstrap:
    Code:
    $this->bootstrap('FrontController');
    $front = $this->getResource('FrontController');

  3. #3
    lion21 is offline Junior Member
    Join Date
    Apr 2009
    Posts
    13

    Default

    Quote Originally Posted by alokin View Post
    First of all, it's not setBaseUrl, but only baseUrl . And second thing, yeah, you can't access base url in your bootstrap, because
    all resources (including frontController) that you're trying to initialize in your application.ini will be executed during bootstrap process.

    However, you can force bootstrapping of some resource from your Bootstrap class, before the bootstrap method is triggered, by calling it, and supplying name of the resource you want to bootstrap:
    Code:
    $this->bootstrap('FrontController');
    $front = $this->getResource('FrontController');

    Thanks dude for opening my eyes , i was making an silly mistake of setBaseUrl instead of baseUrl .

+ Reply to Thread

Similar Threads

  1. Return image from action controller
    By joatack in forum Model-View-Controller (MVC)
    Replies: 6
    Last Post: 06-30-2010, 06:54 AM
  2. Front Controller can't find plugin
    By tixrus in forum Model-View-Controller (MVC)
    Replies: 6
    Last Post: 04-02-2010, 07:28 AM
  3. Front Controller does not seem to be routing
    By Matt1776 in forum Model-View-Controller (MVC)
    Replies: 5
    Last Post: 03-06-2009, 01:42 AM
  4. front controller parameters
    By petran in forum Model-View-Controller (MVC)
    Replies: 1
    Last Post: 09-11-2008, 08:17 AM
  5. Front Controller & Config
    By ssbg in forum Model-View-Controller (MVC)
    Replies: 1
    Last Post: 08-12-2008, 12:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts