CakePHP Media Plugin Helper problem -


i trying display uploaded image media plugin of cakephp.

i added helper controller helper array: var $helpers = array('media.media');. then, in view, have code: echo $media−>file($news['attachment'][0]['dirname'].ds.$news['attachment'][0]['basename']);. problem that, outputs error:

undefined variable: media− [app/views/news/view.ctp, line 3] 

what problem?

by way, if plugin has model user in app/plugin/users/models/user.php , create new model called user in app/models folder 1 loaded?

thanks in advance help!

first off if using 1.3.x refer helpers via $this->helpername->method(), there variable called $media being set in method. can check doing var_dump($media);

the other option has maybe unset it. strange have helper set variable not set. due adding $helpers array wrong controller, can try add app_controller , see if works. if had in wrong place.

if got second question correct, , talking auto loading, plugin controller first model in own plugin directory, if not found there fall app/models directory.

if loading manually via $uses array, depends on version of cake , how it. in previous versions 1.x $uses = array('user'); load plugin model cake auto add plugin prefix. has changed 2.0 afaik.

for other methods of loading model, such $this->loadmodel('user); load app/models , $this->loadmodel('pluginname.user') load app/plugins/plugin_name/models dir.

edit: right funny having error show $media- , there problem. did copy code site? − not - have utf8 char in code complaining about.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -