没有母版页的 Spark 引擎

发布于 2024-08-28 12:06:44 字数 278 浏览 3 评论 0原文

我使用 application.spark 文件作为母版页 在我的应用程序中,我有不需要母版页的登录页面,

我尝试使用此标签从登录页面中删除母版页,但它继续使用 application.spark

我可以通过在布局文件夹中添加名称为空白的新母版页来修复它。没有任何代码的 Spark 文件,并在我的登录页面中放置此标签。

看起来太丑了,所以我问你是否知道解决这个问题的另一种选择?

我正在使用:Spark-1.1.39975.0-release

I use application.spark file for master page
In my app i have login page that does not need master page

I tried remove master page from my login page using this tag , but it continue to use application.spark

I can fix it by adding new master page in layout folder with name blank.spark file without any code and in my login page put this tag .

looks too ugly, so I'm asking you if you know another option to fix this issue?

I'm using: Spark-1.1.39975.0-release

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

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

发布评论

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

评论(3

二智少女 2024-09-04 12:06:44

在控制器操作中,返回 PartialView 而不是 View,并且 Application.spark 布局将被忽略。

In your controller action, return PartialView instead of View, and the Application.spark layout will be ignored.

鸩远一方 2024-09-04 12:06:44

在 Spark 页面的顶部添加:

 <use master="" />

确保您还进行了一次干净的构建,以清除以前构建中的所有内容,以获取空的母版页选择。

At the top of the spark page, add:

 <use master="" />

Make sure you also do a clean build to clean up anything from previous builds to pick up the empty master page selection.

亣腦蒛氧 2024-09-04 12:06:44

有多种方法可以选择应使用哪个主布局文件。以下是选择模板的方法,从最弱到最强。

Views/Layouts 文件夹或 Views/Shared 文件夹中的 Application.spark 文件
这是拥有站点范围主模板的最通用方法。如果控制器返回 PartialView(),则不会使用它。

Views/Layouts 或 Views/Shared 中与控制器同名的 .spark 文件
例如,如果您有一个 AccountController,则可以有一个在该控制器上使用的 Views/Layouts/Account.spark 文件,但所有其他控制器都使用 Views/Layouts/Application.spark 模板。

当您返回 View() 作为 ActionResult 时,将主布局命名为第二个参数
这为控制器提供了布局选择,有些人可能认为这不一定是控制器关心的问题。查要做什么?如果存在,它将覆盖前两个约定。

将主布局命名为视图中的元素。
这实际上是可用于将视图包装在布局文件中的最强大的机制。它将覆盖主选择的传统形式,并且将导致 View() ActionResult 中的主名称(如果存在)被忽略。

来源:http://sparkviewengine.com/documentation/master-layouts

There are several ways to select a which master layout file should be used. The following are the ways a template may be selected, from weakest to strongest.

An Application.spark file in the Views/Layouts folder or Views/Shared folder
This is the most general-purpose way to have a site-wide master template. It will not be used if the controller returns a PartialView().

A .spark file in Views/Layouts or Views/Shared with the same name as the controller
For example if you have an AccountController you could have a Views/Layouts/Account.spark file which is used on that controller, but all other controllers use the Views/Layouts/Application.spark template.

Naming the master layout as the second argument when you return a View() as the ActionResult
This gives the selection of layout to the controller, which some people may believe isn't necessarily a concern for the controller. What'cha gonna do? If this is present it will override the first two conventions.

Naming the master layout as an element in the view.
This is actually the strongest mechanism available for wrapping a view in a layout file. It will override the conventional forms of master selection, and it will cause the name of the master in the View() ActionResult to be ignored if it's present.

Source : http://sparkviewengine.com/documentation/master-layouts

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