Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

php - Where to store application constants in Zend? -


i have few constants i'll need define application, example, site_key contain random key salt passwords.

i'm not sure should define those, though. thought of placing them in public/index.php seems bit messy. there specific place should go, according zend or something?

thanks

edit

i'm trying way: in application.ini have this:

siteglobal.sitekey = "test"

and in bootstrap.php file:

protected function _initglobals() { $config = $this->getoptions(); define('site_key', $config['siteglobal']['sitekey']);  } 

still, isn't working, when try echo site_key in controller this:

echo site_key;

it doesn't show anything. ideas?

in application, i'm combining both haim's , yeroon's approaches. i'm storing application constants in application.ini, parsing them in bootstrap , putting them zend_registry.

so, in application.ini

constants.site_key = my_site_key 

in bootstrap

protected function _initconstants() {     $registry = zend_registry::getinstance();     $registry->constants = new zend_config( $this->getapplication()->getoption('constants') ); } 

then can access these constants place in application (model, controller, etc.)

zend_registry::getinstance()->constants->site_key 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -