Closed zikezhang closed 2 years ago
What is the version of Phalcon?
If you are talking about v5 then:
get_title()
will use Phalcon\Tag
internally so you need to set the title there for it to appear.
title()
or tag.title()
(both work) uses Phalcon\Html\Helper\Title
through the TagFactory
. The signature for that is:
title(string $indent = ' ', string $delimiter = PHP_EOL): string
if you cast that to a string then it will print your title. Volt will do that automatically for you. In your last example you are passing My Title
as the $indent
parameter and this is why it shows up outside the <title>
tags.
echo $this->tag->title()->set('My Title');
$this
->tag
->title()
->setSeparator(' : ')
->set('APPLICATION')
;
// .....
$this->tag->title()->append("My ");
and in the view
{{ tag.title() }}
Thanks, @Jeckerson & @niden . it works well.
Questions? Forum: https://phalcon.io/forum or Discord: https://phalcon.io/discord
Describe the bug Can not show HTML title in front.
To Reproduce
Steps to reproduce the behavior: In Controller:
it returns empty;
Neither:
But:
will show:
My Title<title></title>
(As you can see, "My Title" is out of the tag).