Setting page title in static page view

I am using CakePHP 1.3

I have a static page called temp.ctplocated at app/views/pages/temp.ctp.

Available from my site like: localhost/pages/temp

I am trying to set the page title from a view.

I tried putting each of the following into a temp.ctp file:

<?php $this->set("title_for_layout","Temp Temp Temp"); ?>

and

<? $this->pageTitle = 'Temp Temp Temp'; ?>

The whole file is as follows:

<?php $this->set("title_for_layout","Temp Temp Temp"); ?>


Hello World temp

And uses the standard layout(for header and footer) that comes with cakephp 1.3.

None of them worked. What is the right way to do this?

+3
source share
2 answers

According to the flow in the Google CakePHP group, it can be used $this->set("title_for_layout","Temp");right in your view - in CakePHP 1.3, i.e. 1.2 usesthis->pageTitle = "Temp";

- $title $title_for_layout, :

$this->set("title","Temp");

http://cakephp.lighthouseapp.com/projects/42648/tickets/511-pages-controller-needs-updating-for-title_for_layout

+4

, , , . . HTML : View . - $title_for_layout.

cake/libs/view/layouts/default.ctp. <head> , ,

<title>
    <?php __('CakePHP: the rapid development php framework:'); ?>
    <?php echo $title_for_layout; ?>
</title>

- , viewVars, $this->set("title_for_layout","Temp Temp Temp"); . ( ).

.ctp . autoLayout false . , , .. : var $autoLayout = false; $this->autoLayout = false;.

Cake .ctp . viewVars , $title_for_layout, , hardcode . <head>/<title> .ctp . .

0

Source: https://habr.com/ru/post/1785515/


All Articles