【问题标题】:bolt CMS not routing to singular page of contenttype?螺栓CMS没有路由到内容类型的单一页面?
【发布时间】:2016-01-05 09:44:21
【问题描述】:

我的contenttypes.yml 文件中有一个名为 textimonials 的内容类型,如下所示:

#Testimonials
testimonials:
    name: Testimonials
    singular_name: Testimonial
    fields:
        name:
            type: text
            class: large
        position:
            type: text
        body:
            type: textarea
            height: 150px
    listing_template: testimonials.twig
    record_template: testimonial.twig

现在文档说如下:

每当您的浏览器在 Bolt 网站上获取页面时,它都会使用 URL 像 /entries 或 /page/lorem-ipsum。 Bolt 知道如何处理 URL,例如 这些,并显示浏览器请求的信息。螺栓确实 这是通过将 URL 映射到所谓的 Route 来实现的。这条路线是 控制器(当被调用时)从数据库中获取内容, 选择要使用的模板,根据该模板呈现 HTML 页面 模板和内容并将其提供给浏览器。

同时,如果你创建了一条新记录,Bolt 会知道 该内容的 URL 是。因此,当浏览器请求该 URL 时, 它可以将其映射回正确的内容。

例如,如果您有“Pages”内容类型,“Page”作为 单数名称,您的网站将自动拥有如下页面:

http://example.org/pages
http://example.org/page/lorem-ipsum-dolor

好吧,我在 localhost 上安装了 bolt,所以现在当我导航到 http://localhost:8080/boltCMS/testimonials 时,我看到了我的 testimonials.twig,但是当我导航到 http://localhost:8080/boltCMS/testimonials/1 时,我收到以下错误:

页面推荐/1 未找到。

为什么?我的数据库已填充,为什么会出现此错误?

模板和路由文档可以在 HERE 找到。

谢谢。

【问题讨论】:

    标签: php bolt-cms


    【解决方案1】:

    还有一个内容类型的singular_slug 设置。

    Bolt 会尝试自动解决此问题,但您也可以将其配置为您想要的任何内容。

    【讨论】:

      【解决方案2】:

      试试singular_name 'Testimonial'。

      http://localhost:8080/boltCMS/Testimonial/1
      

      【讨论】:

      • 无论您是否有足够的声誉,这都不是发表评论的正确方式。
      猜你喜欢
      • 2017-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多