du512053619 2018-04-16 00:06
浏览 66

Symfony工具栏没有出现?

for some reason my symfony project, the toolbar which appears at the bottom of the screen has disappeared. I can't recall exactly when this happened, or what I did to trigger it, but it appearing and working at one stage. It is enabled as true in my config_dev.yml file. My AppKernal.php file looks like this

<?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');
}
}

Here is my base.html.twig file

<!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>

And when I inspect the page source the toolbar div id and class appear, and when this is run through a html validator it returns no errors, so I don't know what the problem could be? If you need anymore information regarding my project to help answer my question I'd be happy to help. Thank you

  • 写回答

1条回答 默认 最新

  • dongyi9298 2018-04-16 00:16
    关注

    Solved it. I was messing with the exception files to create my own personal 404 page, after I did that is when the page must have got rid of the toolbar. I undid these changes and issued the command

     php bin/console cache:clear
    

    And voila, the bar is appearing again :)

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大