Hello,
I'm rolling my own helper and noticed that Helper has these functions:
Helper->model() // Gets the currently-used model of the rendering context.
Helper->modelID() // Gets the ID of the currently-used model of the 
rendering context.

It would be handy to get the model name and model ID in the helper because 
it'll help with DRYness. I don't want /the/ model, just the name and ID. For 
example:
$confirmMsg = sprintf('Are you sure you want to delete the %s', 
$this->model());

The Helper class methods are utilising
View->model
View->modelId
defined here: http://api13.cakephp.org/view_source/view/#line-216

However, I just get 'null' for both on every view.

Have they been deprecated? Or should I do something to make sure they're not 
null?

Thanks,
Doug


References:
http://groups.google.com/group/cake-php/browse_thread/thread/aca388fd3f1d4980
Previous advice to use View->model

http://stackoverflow.com/questions/4339118/how-get-name-of-current-model-this-view-context-is-attached-to
The OP doesn't get an answer about why they're null. Just an alternative 
method and a query about whether it is breaking the MVC approach...

https://groups.google.com/forum/#!searchin/cake-php/model$20name$20view/cake-php/2G2-G1YPqkU/4iSZ02S49nUJ
Access the name via passed params

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to