致命错误,而不是404页
问题描述:
我在做一个资源的contentType和使用它的404页其次the guide in the documentation,但不是我看到下面的致命错误的页面:致命错误,而不是404页
Class: Symfony\Component\HttpKernel\Exception\HttpException
Message: The page could not be found, and there is no 'notfound' set in 'config.yml'. Sorry about that.
Code: 0
这很奇怪,因为not found in config.yml设置为:
notfound: resources/not-found
任何想法它可能是什么?这里是的contentType:
resources:
name: Resources
singular_name: Resource
fields:
title:
type: text
class: large
required: true
slug:
type: slug
uses: title
html:
type: textarea
height: 150px
default_status: published
record_template: resource.twig
searchable: false
viewless: true
而且resource.twig:
{{ record.title }}
我创建的/资源/不被发现
答
确保资源记录是404资源的唯一的别名“发表”。
......如果每次我亲自打过这一个,结果都是1美元,那应该是假期。
答
资源内容类型不是正确的工具。使用slug not-found
更好地发布站点并将其设置在配置中。
您的代码无法运行的原因: 您对资源contenttype设置了viewless: true
,这意味着在前端没有它的路由。
它已出版。 – Pharetra