Hi All,
Here's my controller action's code,
function index() {
$this->set('title' , My Title');
}
and this is the code for the view file
<?php echo $title; ?>
pretty simple, right? This page should simply show 'My Title'.
But instead it is showing a notice -
Notice : Undefined variable: title [APP\views\...
I was shocked to see that. Then i dug a little and printed <?php pr($this);
?> from the view. And found that when I am setting a variable named 'title'
for the view from the controller, the view takes the title variable as
pageTitle and makes it the title of page. Is not it weird?
It seems like 'title' is a reserved word for view files. I personally did
not like the idea. If this variable is being used internally by Cake, it
should have some uncommon name or some prefix added to it. So, that this
type of confusion does not arise.
We already have $pageTitle controller attribute to set the page title from
controllers. It seems like a new and hidden alternative way of doing the
same!
It does not look like a regular and usual behavior and if it is an unusual
behavior then it should be fixed.
--
Thanks
Anupom
Trippert Inc. [http://www.trippert.com]
GopherNow. [http://www.gophernow.com/]
Homepage. [http://www.anupom.wordpress.com/]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---