i use this hack for 1.3:
last thing of beforeRender():
# default title
if (empty($this->pageTitle)) {
$this->pageTitle =
__(Inflector::humanize($this->action), true).' |
'.__(Inflector::humanize(!empty($this->params['controller'])?$this-
>params['controller']:$this->name), true);
}
$this->set('title_for_layout', $this->pageTitle);
On 10 Jun., 16:50, Tilen Majerle <[email protected]> wrote:
> Dr. Loboto
>
> this works fine in cake 1.2.x but not in 1.3.x and 2.0
>
> --
> Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> 2011/6/10 Dr. Loboto <[email protected]>
>
>
>
>
>
>
>
> > The way to set this var from controller is $this->pageTitle = 'My own
> > title'; Cake set this value as $title_for_layout itself.
>
> > On Jun 9, 3:08 am, mandar <[email protected]> wrote:
> > > Hi,
>
> > > Im setting title_for_layout in one my Site controllers index() function
> > but
> > > when page is viewed title comes out as name of controller rather than
> > string
> > > that i have set.
>
> > > I have created App_Controller.php file in root of application where i'm
> > > doing some page view recording.
>
> > > Heres sites controller which sets page title in index() method
>
> > > *class SitesController extends AppController {
>
> > > var $components = array('Auth');
>
> > > function beforeFilter()
> > > {
> > > $this->Auth->allow('index');
> > > parent::beforeFilter();
> > > }
>
> > > function index()
> > > {
> > > $this->set('title_for_layout','Page Title Value');
> > > }
>
> > > }*
>
> > > My guess is that thic app_controller is overwriting title field.But not
> > sure
> > > how do i get it to work
>
> > > Can any one tell me what im doing wrong or whast the solutions to get
> > title
> > > to display correctly in layout files?
>
> > > thanks,
>
> > > Mandar
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > [email protected] For more options, visit this group
> > athttp://groups.google.com/group/cake-php
--
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