【问题标题】:Orchard CMS @IF statement in Layout布局中的 Orchard CMS @IF 语句
【发布时间】:2014-09-08 16:02:21
【问题描述】:

如果有@IF 语句,知道如何更改 Orchard CMS 中的布局。

基本上在主页上我需要一个额外的所以我需要 If homepage { (then do this) } Else { do that}

@if (Request.Url.ToString ().Equals("http://localhost:5603/"))
{
<h1>Shows on HomePage</h1>
             }
else
{
<h1>Sows on Everything Else</h1>   
}

编辑:

它很脏,但对我有用

@if (Request.Url.ToString().EndsWith("/"))
{
<h1>Shows on HomePage</h1>
}
else
{
<h1>Sows on Everything Else</h1>   
}

【问题讨论】:

  • 你能提供一些示例代码吗?你已经尝试过什么了吗?
  • 对不起,我当时正在工作:-)
  • @if (Request.Url.ToString ().Equals("localhost:5603/")) {

    在主页上显示

    } else {

    在其他一切上播种

    h1> }
  • 但我不想将 LocalHost 用于我尝试过“/”但仍显示在所有页面上的主页

标签: razor content-management-system orchardcms


【解决方案1】:

了解图层和小部件的工作原理,您将能够根据规则将任何信息放置在您想要的位置(例如:url = ~/): http://docs.orchardproject.net/Documentation/Managing-widgets

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-19
    相关资源
    最近更新 更多