class Pie extends AppModel {
var $friendlyName = 'A tasty treat!';
var $actsAs = array('Tasty'); // Optional
}
class AppController extends Controller {
function beforeFilter() {
if (!empty($this->modelClass)) {
$this->set('title', $this->{$this->modelClass}->friendlyName . '
- foooooooooood');
}
}
}
Although... some might question the wisdom of setting a view-level
parameter in the controller and the model.
hth
grigri
On Jun 10, 1:37 pm, Smelly_Eddie <[EMAIL PROTECTED]> wrote:
> I have always used the function below in my controllers to set the
> page's title.
>
> function beforeFilter(){
> $this->pageTitle= $this->name.' - .:: The GreenLife List ::.
> ';
>
> }
>
> The problem is that some model names are concatenated due to their
> HABTM nature, like "customerproductreviews"
>
> I thought I could just set a variable in the Model like
> '$displayName', but the controllers don't see such a variable.
>
> I know there must be a way to assign readable and formatted model
> names to use in the page title.
>
> It wold also be useful when other models read related data, the bake
> script could show "related customer reviews" in my other models,
> rather than the ugly one word name.
>
> Any help?, yes I have tried google, but what to search?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---