Graffiti CMS:视图覆盖

发布于 2024-08-07 17:57:11 字数 937 浏览 5 评论 0原文

我有一个 Graffiti CMS (http://graffiticms.com) 问题,这些问题让我抓狂。我认为这将是尝试获得答案的最佳场所,同时希望为具有相同问题的其他人提供答案。

首先,我有一个像这样的网站结构:

  • Category1
    • 子类别1
  • 类别 2
    • 子类别3
    • 子类别4
    • ---帖子1
    • ---帖子2

我的主题中有 .view 文件。我有一个category2.sub-category4.view 文件,理论上它会用我选择的格式替换显示子类别中的帖子的index.view 文件(这部分正在工作)。

不起作用,我不明白的是,当我转到 localhost/category2/sub-category4/post1/ 查看帖子时,它还使用category2.sub-category4.view 尝试显示帖子的内容。但由于 .view 文件被设置为显示帖子列表,因此它不会正确显示。使用 post.view 呈现帖子的预期行为是什么。

根据 http://graffiticms.com/old-support/designers /making-use-of-views/category2.sub-category4.view 应该覆盖 index.view 并且它没有说明它覆盖 post.view 的任何内容。

我已经尝试了我能想到的所有命名模式,如果我更改类别,它似乎总是会覆盖我的 post.view 。任何帮助表示赞赏。

I've got a Graffiti CMS (http://graffiticms.com) questions that is driving me crazy. I figured this would be the best place to try to get an answer and at the same time hopefully provider an answer for someone else with the same issue.

First, I have a site structure like this:

  • Category1
    • Sub-Category1
  • Category2
    • Sub-Category3
    • Sub-Category4
    • ---Post1
    • ---Post2

I have my .view files in the theme. I have a category2.sub-category4.view file which in theory replaces the index.view file displaying the posts within the subcategory with the formatting of my choosing (this part is working).

What isn't working, and I can't figure out is when I go to localhost/category2/sub-category4/post1/ to view the post, it is also using the category2.sub-category4.view to try to display the contents of the post. But since the .view file was setup to display a list of posts it isn't going to display properly. What the expected behavior is for it to use post.view to render the post.

According to http://graffiticms.com/old-support/designers/making-use-of-views/ category2.sub-category4.view should override index.view and it doesn't say anything about it overriding post.view.

I've tried every naming schema I can think of, and if I change the category it always seems to override my post.view as-well. Any help is appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

幼儿园老大 2024-08-14 17:57:11

在所有视图中,Graffiti 都包含一个 $where 变量,其中包含您可能会使用的标志。

#if($where == 'category')
Your list view
#else
Your post specific view
#endif

当然并不完美(我认为这个问题已经解决),但这应该可以帮助您克服这个障碍。

In all the views, Graffiti includes a $where variable which contains a flag you could potentially use.

#if($where == 'category')
Your list view
#else
Your post specific view
#endif

Not perfect for sure (I thought this issues had been resolved), but that should help you through this hurdle.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文