PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, February 18, 2022

[FIXED] using title in view (template) in CakePHP 3

 February 18, 2022     cakephp-3.0     No comments   

Issue

I want to print title in my view (Template) in CakePHP3.

$this->fetch('title') is working fine in element and default.ctp but when using this in view it is printing nothing.

How could I print title in view using $this->fetch('title')?


Solution

In your view file you should assign some value to the title variable

$this->assign('title', 'Example title text');

Than in your template you should have

<?= $this->fetch('title') ?>


Answered By - rrd
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing