我有一个XSLT脚本来输出一个简单的垂直菜单,但是在我的几个链接上,文本没有包装,我不明白为什么!
试过把DIV放在链接里面,还有一个
包含文本但无济于事.
以前有人有过这种问题吗?
XSLT:
<xsl:template match="/">
<xsl:variable name="items" select="$currentPage/ancestor-or-self::* [@isDoc and @level = 2]/* [@isDoc and string(umbracoNaviHide) != '1']"/>
<!-- The fun starts here -->
<div id="subnavtitle">
<xsl:value-of select="$currentPage/@nodeName" />
</div>
<xsl:if test="count($items) > 0">
<ul>
<xsl:for-each select="$items">
<li>
<xsl:if test="@id = $currentPage/@id">
<xsl:attribute name="class">current</xsl:attribute>
</xsl:if>
<xsl:if test="@id = $currentPage/../@id">
<xsl:attribute name="class">current</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}" >
<p style="width: 100px;">
<xsl:value-of select="translate(@nodeName,' ',' ')"/>
</p>
</a>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)
CSS:
#subNavigation {
padding-top: 10px;
padding-right: 10px;
padding-left: 10px; …Run Code Online (Sandbox Code Playgroud) 我在xslt中有一个值,我需要把它放到p标签的data-time属性中
<xsl:value-of select="current()/eventTime" />
<p class="time" data-time="1">Duration: <xsl:value-of select="current()/eventTime" /> hour(s)</p>
Run Code Online (Sandbox Code Playgroud)
这会产生错误
<p class="time" data-time="<xsl:value-of select="current()/eventTime" />">Duration: <xsl:value-of select="current()/eventTime" /> hour(s)</p>
Run Code Online (Sandbox Code Playgroud)
知道我是怎么做到的吗?
[编辑]我实际上被允许使用文档名称,这使得它更容易,但我仍然认为找出它是否可能会很有趣.
我必须设置一个触发器,将内容复制到内容树上的不同分支,因为该站点将使用多种语言.有人告诉我,我不能按名称访问文件(因为它们可能会改变),我也不应该使用节点ID(不是我知道如何,过了一段时间后会很难遵循结构).
如何遍历树以将新文档插入其他语言的相关子分支中?有办法吗?
我第一次与Umbraco 7和Umbraco合作.我试图从实现RenderMvcController的自定义控制器重定向到另一个页面.
我尝试过ASP.NET MVC return RedirectToAction("Index", "Home");,但这似乎不起作用.
有谁知道如何实现这一目标?
我正在开发一个安装了MVC 4和Umbraco CMS的项目.我道歉 - 作为新手,我的问题可能很奇怪.
我的问题是:如何处理我不想通过Umbraco后台管理的类型?相反,它将是简单的数据来源并存储在SQL Server中.
具体来说我想问:
SurfaceController还是RenderMvcController?同样,它不会是Umbraco文档类型或数据.UmbracoViewPage,UmbracoTemplatePage还是标准的MVC视图?非常感谢你宝贵的时间,指导,分享和帮助; 我非常感谢.
我注意到至少有两种方法可以在Umbraco中编写日志.一种方法是使用LogHelper类,另一种方法是直接使用方法获得的实例的log4net.LogManager.GetLogger方法.毋庸置疑,LogHelper本身也使用log4net.
我添加了一个自定义日志appender,将appender的文件目标设置为自定义文件(与默认文件不同)并尝试两种方式,并注意到日志中的结果或多或少相同.LogHelper的条目如下所示:
错误ProjectName.Controllers.Backoffice.DataController - [P4876/T1/D2]测试
而log4net的条目如下所示:
错误ProjectName.Controllers.Backoffice.DataController - 测试
但是,当我搜索有关登录Umbraco的帖子时,我经常找到直接使用log4net的示例,而不是使用Umbraco CMS提供的LogHelper类.
所以基本上,有没有什么好的理由开发人员应该使用一种方式而不是另一种方式,或者仅仅是使用库的方法而不是使用CMS提供的帮助类(或者相反的方式 - 帮助图书馆)?
是否可以将html字符串输出到csv.
尝试将数据从cms导出到csv和Excel.每个html都可以包含逗号和任何内容.
EG. <p class="myclass">This is an example, of the string</p>
Run Code Online (Sandbox Code Playgroud)
导入在Excel中被破坏,错误的数据出现在错误的列中,尽管前几行是正确的.
我想实现这种格式
col1,col2,col3
"1","<p class="myclass">This is an example, of the string</p>","and more html here"
Run Code Online (Sandbox Code Playgroud)
我尝试过这种事情 - 我在cms中迭代一个内容项,并输出每个属性作为用引号括起来并用逗号分隔的单独的csv数据值.
foreach (var prop in offer.Properties) //.Where(x=>x.Alias != "Id"))
{
var @propValue = prop.Value.ToString().Replace("\"", "'");
// Append comma except last
sb.Append(prop != offer.Properties.Last()
? "\"" + propValue + "\","
: "\"" + propValue + "\"");
}
sb.Append(Environment.NewLine);
Run Code Online (Sandbox Code Playgroud)
更新: 事实证明,这项任务充满了困难.最初的目标是将一组节点及其属性从Umbraco CMS快速导出到Excel文件.我了解到csv可能不是这种类型数据的正确格式,它基于存储在xml中的数据,包括编码的html片段.
在我们的例子中,实现我们想要的最好方法是将导出的数据输出为Excel理解的html表,并保持编辑器友好格式而不是编码的html片段.
我想申请Umbraco Collection的条件.
码:
var workList = CurrentPage.work.ToString().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
var workCollection = Umbraco.Content(workList);
@foreach (var item in workCollection.Where("productImage!=\"\"").Skip((i - 1) * iterationCount).Take(iterationCount))
Run Code Online (Sandbox Code Playgroud)
我有一个简单的Umbraco 7.7.2应用程序,我在Azure(app-service)上托管它.当我重新启动服务器时,第一次请求一个非常烦人的页面需要20-40秒,特别是当负载很高时,你需要缩小以减少响应时间.
我在webconnfig中尝试过这个设置,但它似乎不起作用.
<system.webServer>
<applicationInitialization>
<add initializationPage="/page1/?warmup=1" hostName="mydomain.com" />
<add initializationPage="/page1/page2/?warmup=1" hostName="mydomain.com" />
</applicationInitialization>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)
我可能会以错误的方式尝试它,但我做的是重新启动服务器,我已经离开它2-3分钟而没有请求任何页面.
我检查了我的Umbraco日志,应用程序甚至没有启动.然后我已经请求了主页,它花了40秒才出现.
然后我尝试了mydomain.com/page1,它也花了20秒,因为它是第一个访问它的请求.
*PS:第一次请求后,网站速度非常快,每页加载时间不到100毫秒
我已经实现了重写以阻止下一次重定向,正如Kevin建议的那样.结果,我的Umbraco将启动,但请求仍然没有到达页面.
在我的母版页,我添加了一行写在日志中的线路,如果它在查询字符串的热身和它的作品在页面从浏览器hitted:
if (!string.IsNullOrWhiteSpace( Request.QueryString["warmup"]))
{
var pageC = Model.Content;
logger.Info(pageC.UrlAbsolute()+" "+ Request.QueryString);
}
Run Code Online (Sandbox Code Playgroud)
但是,我的日志中没有任何内容
2018-02-08 15:16:51,245 [P7036/D2/T1] INFO Umbraco.Core.CoreBootManager - Umbraco应用程序启动完成(耗时12727ms)2018-02-08 15:16:54,911 [P7036/D2/T1] INFO MyNamespace.Web.CustomStartup - 基本配置完成!
这是我根据Kevin的回答添加的混淆:
<rule name="No redirect on warmup request (request from localhost with warmup user agent)" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{REMOTE_ADDR}" pattern="127.0.0.*" />
</conditions>
<action type="Rewrite" url="{URL}" />
</rule>
Run Code Online (Sandbox Code Playgroud)
另外,我在微软上发现了另一个类似的配置: …
我正在使用 Azure Active Directory 向运行 Umbraco 版本 11.0 的网站上的 Backoffice 提供身份验证。
这运行良好,我可以登录,但我想通过使用 Azure 中的应用程序角色来管理 Umbraco 中的用户组来改善体验。
我的 Azure 设置
我已使用以下配置在 Azure 中创建了应用程序注册:
Access tokens (used for implicit flows)ID tokens (used for implicit and hybrid flows)Accounts in this organizational directory only (Example only - Single tenant)在企业应用程序中,我还将上面的应用程序角色添加到我的用户:
我的代码
登录提供商
namespace Example.Api.Features.Authentication.Extensions;
public static class UmbracoBuilderExtensions
{
public static IUmbracoBuilder ConfigureAuthentication(this IUmbracoBuilder builder)
{
builder.Services.ConfigureOptions<OpenIdConnectBackOfficeExternalLoginProviderOptions>();
builder.AddBackOfficeExternalLogins(logins =>
{
const string schema …Run Code Online (Sandbox Code Playgroud)