小编Dhe*_*iri的帖子

使用Sitecore页面编辑器进行Jquery

我需要在一行中的第一个单词周围放置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>
        &lt;<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"&gt;<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&amp;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)

任何建议都会有所帮助.

javascript jquery sitecore sitecore-dms page-editor

8
推荐指数
1
解决办法
1900
查看次数

在Sitecore 6.5中按ID获取项目

我在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)

c# sitecore sitecore6

7
推荐指数
1
解决办法
2万
查看次数

Sitecore 8安装指南

我正在尝试安装Sitecore 8.我收到一条错误消息"不支持SQL Server版本 - SQLServer(10.50.1600.1)"我试图找到安装文档以了解数据库要求.我找不到任何地方,可能是我在错误的地方找.

doc.sitecore.net

kb.sitecore.net

有人可以指出我正确的方向.

installation sitecore sitecore8

6
推荐指数
1
解决办法
1万
查看次数

Sitecore TDS代码生成错误

我试图通过遵循GlassTutorial24 TDS版本:5.1.0.3,visual studio 2012 从TDS代码生成生成代码.

生成的类只有"ErrorGeneratingOutput".

我的项目属性如下: TDS项目属性

编辑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

code-generation sitecore glass-mapper sitecore7.5

4
推荐指数
1
解决办法
2819
查看次数

Sitecore字段ID与字段名称相对应

我在"专业Sitecore开发"一书中读到了 - 约翰·韦斯特说,最好的做法是在获取项目字段值时使用字段ID代替字段名称.

但是像sc:text,sc:link,sc:image等的sitecore控件有一个名为field的属性,它使用字段名称.所以,我现在很困惑是将整个项目更改为Field ID,还是将字段名称保留为与sitecore使用一致.

任何建议将不胜感激.

c# sitecore sitecore6 sitecore-dms

3
推荐指数
1
解决办法
3012
查看次数

Bson数组中的字符串列表

我使用的是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添加到查询时才会出现此错误消息.

.net c# linq mongodb mongodb-.net-driver

3
推荐指数
1
解决办法
8035
查看次数

以特定语言以编程方式创建sitecore项目

我试图以编程方式创建一个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)

c# sitecore sitecore6

3
推荐指数
2
解决办法
6586
查看次数

Glass Mapper IEnumerable <Guid>到IEnumerable <Object>

我正在使用glass mapper和TDS代码生成模板为我的sitecore模板生成模型.

一切顺利.但是,如果我有一个多列表字段TDS模板正在创建IEnumerable<Guid>.我想要它IEnumerable<OtherSitecoreTemplate>.如果我手动更改它的工作.但是下次重新生成代码时,我的所有更改都将丢失.

有一个更好的方法吗?

c# code-generation sitecore tds glass-mapper

2
推荐指数
1
解决办法
1366
查看次数

Sitecore为特定站点设置默认富文本编辑器

如果我们想要更改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

1
推荐指数
1
解决办法
94
查看次数

值不能为空.参数名称:virtualPath - Sitecore

我在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的预览模式下工作正常.

任何建议将不胜感激.

xml sitecore sitecore7.1

1
推荐指数
2
解决办法
3404
查看次数

PagedList MVC仅显示大于当前页码的页码

我使用PagedList创建了一个mvc项目的分页,一切正常,直到有新的需求出现:

  • 第1页:1,2,3,4,5下一页
  • 第2页:上一页2,3,4,5,6下一页[ 数字在用户查看更多页面时上升 ]
  • 第3页:上一页3,4,5,6,7下一页[ 数字以用户查看更多页面的方式提升 ]

有没有办法做到这一点?我检查了PagedListRenderOptions(),找不到这个属性.

任何建议将不胜感激.

asp.net-mvc pagination pagedlist

0
推荐指数
1
解决办法
2572
查看次数

Glass Mapper Droplink显示名称而不是Guid

我正在使用glass mapper,我的模板中有一个droplink列表.当我试图检索该项目时,它会将所选的guid带回droplink而不是名称.如何显示在droplink和guid中选择的名称?

sitecore glass-mapper

0
推荐指数
1
解决办法
946
查看次数