Symfony工具栏没有显示?

时间:2018-04-16 00:06:31

标签: php html symfony

由于某些原因,我的symfony项目,屏幕底部出现的工具栏已经消失。我无法准确地回想起这发生的时间,或者我做了什么来触发它,但它出现并在一个阶段工作。它在我的config_dev.yml文件中启用为true。我的AppKernal.php文件看起来像这样

<?php

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
public function registerBundles()
{
    $bundles = [
        new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
        new Symfony\Bundle\SecurityBundle\SecurityBundle(),
        new Symfony\Bundle\TwigBundle\TwigBundle(),
        new Symfony\Bundle\MonologBundle\MonologBundle(),
        new Symfony\Bundle\AsseticBundle\AsseticBundle(),
        new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
        new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
        new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
        new FOS\RestBundle\FOSRestBundle(),
        new FOS\CommentBundle\FOSCommentBundle(),
        new JMS\SerializerBundle\JMSSerializerBundle($this),
        new AppBundle\AppBundle(),
    ];

    if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
        $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
        $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
        $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();

        if ('dev' === $this->getEnvironment()) {
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
            $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
        }
    }

    return $bundles;
}

public function getRootDir()
{
    return __DIR__;
}

public function getCacheDir()
{
    return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
}

public function getLogDir()
{
    return dirname(__DIR__).'/var/logs';
}

public function registerContainerConfiguration(LoaderInterface $loader)
{
    $loader->load(function (ContainerBuilder $container) {
        $container->setParameter('container.autowiring.strict_mode', true);
        $container->setParameter('container.dumper.inline_class_loader', true);

        $container->addObjectResource($this);
    });
    $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
}
}

这是我的base.html.twig文件

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>{% block title %}Health Centre Ireland{% endblock %}</title>
{% block stylesheets %}
    <link rel="stylesheet" href="{{ asset('css/css/bootstrap.css') }}"/>
    <link rel="stylesheet" href="{{ asset('css/styles.css') }}"/>
    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
{% endblock %}
<link rel="icon" type="image/x-icon" href="{{ asset('redcross.ico') }}" />
</head>

<body>
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<a class="navbar-brand" href="#">Health Centre Ireland</a>
<button class="navbar-toggler" type="button" data-toggle="collapse"
        data-target="#navbarsExampleDDefault" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
</button>

<div class="collapse navbar-collapse" id="navbarsExampleDefault">
    <ul class="navbar-nav mr-auto">
        <li class="nav-item">
            <a class="nav-link" href="{{ path('login') }}">Home <span class="sr-only"></span> </a>
        </li>

        <li class="nav-item">
            <a class="nav-link" href="{{ path ('scheduler') }}">Calender</a>
        </li>

        <li class="nav-item">
            <a class="nav-link" href="#">Message Board</a>
        </li>

        <li class="nav-item">
            {% if app.user %}
                <a class="nav-link" href="
                {{ logout_path('main') }}">
                    Log Out</a>
            {% else %}
                <a class="nav-link" href="
                {{ path ('login') }}">
                    Log In</a>
            {% endif %}

        <li class="nav-item">
            {% if app.user %}
                <a class="nav-link" href="{{ path('deleteuser') }}"> Delete Account</a>
            {% endif %}
        </li>
    </ul>
</div>

{% if app.session.flashBag.has('success') %}
    <div class ="alert alert-success">
        {% for msg in app.session.flashBag.get('success') %}
            {{ msg }}
        {% endfor %}
    </div>
{% endif %}
</nav>



{% block body %}{% endblock %}
{% block javascripts %}{% endblock %}
</body>
</html>

当我检查页面源时,工具栏div id和class出现,当这是通过html验证器运行时它没有返回错误,所以我不知道问题可能是什么? 如果您需要有关我的项目的更多信息以帮助回答我的问题,我很乐意提供帮助。 谢谢

2 个答案:

答案 0 :(得分:0)

解决了它。我正在搞乱异常文件来创建我自己的个人404页面,在我这样做之后,页面必须摆脱工具栏。我解除了这些更改并发出了命令

 php bin/console cache:clear

瞧,酒吧又出现了:)

答案 1 :(得分:0)

很多时候服务器localhost / vps配置设置不正确

添加

brainpopup.addEventListener("mouseover", function(){
  example.querySelector("img").style.display = "block";
})
brainpopup.addEventListener("click",function(){
example.querySelector("img").style.display="none";
})