我需要在一行中的第一个单词周围放置span标签.我使用下面的Jquery,它在sitecore标准模式下工作正常.
$("body").has(".widget h2").addClass("standard-mode");
$("body").has(".scLoadingIndicatorInner").removeClass("standard-mode").addClass("page-edit");
$('.standard-mode .widget h2').html(function(i, html){
return html.replace(/(\w+\s)/, '<span>$1</span>')
})
Run Code Online (Sandbox Code Playgroud)
当我第一次加载页面编辑器时,这也可以正常工作(不插入span标签),但是当我创建一个多变量测试时,使用箭头标记在A/B之间切换显示就像插入不应该设想的span标签一样在页面编辑模式下执行,但它确实打破了html,如下所示.
<h2>
<<span>input </span>id="fld_D26C954B73BE4C62B6F25BE191A86F18_7B55B5E5EDD84D4E88B16C6E073495A5_en_1_0e80a9c63ab6419f8135b70511e892f1_16487" class="scFieldValue" name="fld_D26C954B73BE4C62B6F25BE191A86F18_7B55B5E5EDD84D4E88B16C6E073495A5_en_1_0e80a9c63ab6419f8135b70511e892f1_16487" type="hidden" value="Badger Cull"><span class="scChromeData">{"commands":[{"click":"chrome:common:edititem({command:\"webedit:open\"})","header":"Edit the related item","icon":"/temp/IconCache/SoftwareV2/16x16/cubes_blue.png","disabledIcon":"/temp/cubes_blue_disabled16x16.png","isDivider":false,"tooltip":"Edit this item in the Content Editor.","type":"common"},{"click":"chrome:rendering:personalize({command:\"webedit:personalize\"})","header":"Personalize","icon":"/temp/IconCache/PeopleV2/16x16/users3_edit.png","disabledIcon":"/temp/users3_edit_disabled16x16.png","isDivider":false,"tooltip":"Personalize component.","type":"sticky"},{"click":"javascript:Sitecore.PageModes.PageEditor.postRequest('ActiveISPageEditor:publish(id={D26C954B-73BE-4C62-B6F2-5BE191A86F18})',null,false)","header":"Publish the related item","icon":"/temp/IconCache/Network/16x16/download.png","disabledIcon":"/temp/download_disabled16x16.png","isDivider":false,"tooltip":"Publish this item.","type":"common"},{"click":"chrome:rendering:editvariations({command:\"webedit:editvariations\"})","header":"Edit variations","icon":"/temp/IconCache/SoftwareV2/16x16/breakpoints.png","disabledIcon":"/temp/breakpoints_disabled16x16.png","isDivider":false,"tooltip":"Edit the variations.","type":"sticky"}],"contextItemUri":"sitecore://master/{D26C954B-73BE-4C62-B6F2-5BE191A86F18}?lang=en&ver=1","custom":{},"displayName":"Header Text","expandedDisplayName":null}</span><span scfieldtype="single-line text" sc_parameters="prevent-line-break=true" contenteditable="false" class="scWebEditInput scEnabledChrome" id="fld_D26C954B73BE4C62B6F25BE191A86F18_7B55B5E5EDD84D4E88B16C6E073495A5_en_1_0e80a9c63ab6419f8135b70511e892f1_16487_edit" sc-part-of="field">Badger Cull</span>
</h2>
Run Code Online (Sandbox Code Playgroud)
任何建议都会有所帮助.
我在Sitecore 6.5上.
下面的代码工作正常,但我不明白如何.该GetItem()方法有六个重载函数,它将字符串值作为项目路径.
在这种情况下,它将id作为字符串并正确返回项目(位置是Sitecore droplink字段).我错过了什么吗?
private Sitecore.Data.Items.Item LocationItem
{
get
{
return Sitecore.Context.Database.GetItem(Item["Location"]);
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试安装Sitecore 8.我收到一条错误消息"不支持SQL Server版本 - SQLServer(10.50.1600.1)"我试图找到安装文档以了解数据库要求.我找不到任何地方,可能是我在错误的地方找.
有人可以指出我正确的方向.
我试图通过遵循GlassTutorial24 TDS版本:5.1.0.3,visual studio 2012 从TDS代码生成生成代码.
生成的类只有"ErrorGeneratingOutput".
我的项目属性如下:

编辑1:
构建时出错:
错误1编译转换:无法找到元数据文件'HedgehogDevelopment.CodeGeneration.Extensions.dll'xxx.TDS.Master \代码生成模板\ glassv3header.tt
错误2编译转换:类,结构或接口成员声明中的令牌"this"无效xxx.TDS.Master \代码生成模板\ GlassV3Item.tt
错误3编译转换:方法必须具有返回类型xxx.TDS.Master \代码生成模板\ GlassV3Item.tt
错误4编译转换:键入expected xxx.TDS.Master\Code Generation Templates\GlassV3Item.tt
我在"专业Sitecore开发"一书中读到了 - 约翰·韦斯特说,最好的做法是在获取项目字段值时使用字段ID代替字段名称.
但是像sc:text,sc:link,sc:image等的sitecore控件有一个名为field的属性,它使用字段名称.所以,我现在很困惑是将整个项目更改为Field ID,还是将字段名称保留为与sitecore使用一致.
任何建议将不胜感激.
我使用的是MongoDb 2.4.9版本.当我尝试将字符串列表转换为Bson数组时,我最终会出现以下错误:
BsonArray bArray = new BsonArray();
foreach (var term in termMonitorIds)
{
bArray.Add(term.ToBson());
}
Run Code Online (Sandbox Code Playgroud)
'/'应用程序中的服务器错误.
String值无法写入BSON文档的根级别.
描述:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息.
异常详细信息:System.InvalidOperationException:无法将String值写入BSON文档的根级别.
编辑
当我在下面的LINQ查询中使用它时:
entities =
(from e in this.collection.AsQueryable<SocialRecord>()
where sources.Contains(e.SocialType) && (e.DateCreated >= fr) && (e.DateCreated <= to) && e.TermMonitorIds.Any(X=> bArray.Contains(X)) && e.IsExactMatch == isInstagramExactMatch
select e)
.Take(5000)
.ToList();
Run Code Online (Sandbox Code Playgroud)
结果值不能为空.参数名称:名称.仅当我将bArray添加到查询时才会出现此错误消息.
我试图以编程方式创建一个sitecore项目.一切顺利.但我创建的项目是使用语言"EN-GB",但创建的新项目是使用语言"EN".有没有办法在创建项目时设置语言值.
var currentDatabase = Sitecore.Configuration.Factory.GetDatabase(selectedItem.Database.Name);
if (currentDatabase != null)
{
var rootItem = currentDatabase.GetItem(RootItemPath);
if (rootItem != null)
{
//Create new item
var item = rootItem.Add(selectedItem.Name, CommunityProjectTemplateId);
if (item != null)
{
item.Fields.ReadAll();
item.Editing.BeginEdit();
try
{
//Add values for the fields
item.Fields["Overview Body Content"].Value = selectedItem.GetStringField("ProjectOverview");
}
catch (Exception)
{
item.Editing.EndEdit();
}
}
}
}
Run Code Online (Sandbox Code Playgroud) 我正在使用glass mapper和TDS代码生成模板为我的sitecore模板生成模型.
一切顺利.但是,如果我有一个多列表字段TDS模板正在创建IEnumerable<Guid>.我想要它IEnumerable<OtherSitecoreTemplate>.如果我手动更改它的工作.但是下次重新生成代码时,我的所有更改都将丢失.
有一个更好的方法吗?
如果我们想要更改sitecore网站的默认富文本编辑器,我们可以在下面选择更改.
<setting name="HtmlEditor.DefaultProfile" value="/sitecore/system/Settings/Html Editor Profiles/Rich Text Default" />
Run Code Online (Sandbox Code Playgroud)
我的sitecore实例中有三个网站.有什么办法可以为每个网站指定不同的默认RTE.我在Sitecore 6.5上
我在sitecore网站配置部分创建了一个新网站:
<site name="site2" hostName="website.local" virtualFolder="/oscar-dresses" physicalFolder="/" rootPath="/sitecore/content" targetHostName="website.local" startItem="/Oscar Dresses" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
<site name="website" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" hostName="website.local" targetHostName="website.local" startItem="/home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
Run Code Online (Sandbox Code Playgroud)
一旦我在配置中添加新网站,当我转到http://website.local/oscar-dresses.我得到的价值不能为空.参数名称:virtualPath.我错过了什么吗?它在sitecore的预览模式下工作正常.
任何建议将不胜感激.
我使用PagedList创建了一个mvc项目的分页,一切正常,直到有新的需求出现:
有没有办法做到这一点?我检查了PagedListRenderOptions(),找不到这个属性.
任何建议将不胜感激.
我正在使用glass mapper,我的模板中有一个droplink列表.当我试图检索该项目时,它会将所选的guid带回droplink而不是名称.如何显示在droplink和guid中选择的名称?
sitecore ×10
c# ×5
glass-mapper ×3
sitecore6 ×3
sitecore-dms ×2
.net ×1
asp.net-mvc ×1
installation ×1
javascript ×1
jquery ×1
linq ×1
mongodb ×1
page-editor ×1
pagedlist ×1
pagination ×1
sitecore7.1 ×1
sitecore7.5 ×1
sitecore8 ×1
tds ×1
xml ×1