|
|||
|
Hello,
I'm just new using the Zend Framework and i'm testing some stuff. At the moment i'm bussy in my bootstrap file where I declare some of my objects, for example a log-object, translate-object, ... Now I just want to call those object in my *.phtml files. 've read some stuff about the Zend Registry Class and I can use it, so what I do now in my phtml file is (translate object is known in my bootstrap file): PHP Code:
Thx |
|
|||
|
No, your always going to have to have that atleast once, either in your controller or your view.
Remember your view scripts are within the scope of the controller, so you could set it in your controller init() to get it and save it to the $-view but there is NO point at all. If you do it by reference (which you should) then its just a benefit for not writing the extra line, but if you don't then you are just duplicating the data. My translation file of 3MB would mean that an extra 6Mb is saved in RAM. Not worth it. Overall, its not that big of a deal to just add the extra line is it? |
|
|||
|
Thanky you very much for the information, so if i'am correct, i should call this in my controller:
PHP Code:
For me it's not about typing the extra line, it's just that I would like to optimize my php-code and therefore i asked the question. ![]() |
|
|||
|
Couldn't You just use PHPTAL :: Template Attribute Language for PHP as view? It's really great project and best thing is that it perfectly cooperate with ZF (You can pass objects directly to template). There is also i18n: PHPTAL
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|