1

I have place this on my application.ini file:

contact.email.address = "[email protected]"
contact.email.name = "Test Name"

Then on my index controller action I have done:

$configOptions = $this->getInvokeArg('bootstrap')->getOptions();
$contactAddress = $configOptions->contact.email.address;
$this->view->contact = $contactAddress;

On my view I have:

var_dump($this->contact); but I'm receiving NULL.

What am I missing ?

2 Answers 2

5

In your controller, I think you want:

$configOptions = $this->getInvokeArg('bootstrap')->getOptions();
$contactAddress = $configOptions['contact']['email']['address'];
$this->view->contact = $contactAddress;
Sign up to request clarification or add additional context in comments.

3 Comments

Or: $configOptions = new Zend_Config($this->getInvokeArg('bootstrap')->getOptions()); and then: $configOptions->contact->email->address; - my bad syntax errors... :((
Right, I usually create this Zend_Config instance during Bootstrap and save it someplace so that I can access it later using the cleaner syntax you identify here.
Yeah, I usually save the Zend_Config instance using the Zend_Registry
2

You can use:

$configOptions = new Zend_Config($this->getInvokeArg('bootstrap')->getOptions());
$contactAddress = $configOptions->contact.email.address;
$this->view->contact = $contactAddress;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.