Search code examples
phpphalconvolt

Phalcon Overwriting <head> of View Files


Even I have a different title in my head section, Phalcon replaces it, with Phalcon PHP Framework

My Volt File :

<head>
   <title>Search</title>
   <link rel="shortcut icon" href="https://raw.githubusercontent.com/phalcon/invo/master/public/favicon.ico" type="image/x-icon"/>
</head>

While at browser this becomes :

    <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>Phalcon PHP Framework</title>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
    </head>

From where does this title and bootstrap link came? And how to remove it.

Edit: Changed IndexController to :

<?php

class IndexController extends ControllerBase
{
    public function initialize()
    {
        $this->tag->setTitle('Welcome');
    }

    public function indexAction()
    {

    }

}

And Index.volt to :

<head>
    {{ get_title() }}
    <link rel="shortcut icon" href="https://raw.githubusercontent.com/phalcon/invo/master/public/favicon.ico" type="image/x-icon"/>

Still title remains same. Deleted browser cache to confirm

Thanks.


Solution

  • The problem was that view/index/index.volt was automatically inheriting view/index.volt. I removed the lines from there, which solved the problem.