sitecore

Sitecore MVC Ensure empty placeholder is selectable in experience editor

☆樱花仙子☆ 提交于 2019-12-12 18:16:48
问题 Is there some trick with placeholders in Sitecore MVC to ensure that they are always selectable in the page editor experience editor even when they don't contain any renderings? My controller rendering declares the placeholder in the cshtml view as follows: <div> <!-- some html markup and fields rendered here --> @Html.Sitecore().Placeholder("my-component-placeholder") </div> 回答1: To ensure placeholder visibility and selectability, you need to ensure the following: A placeholder settings item

Cannot access sitecore item field via API

爱⌒轻易说出口 提交于 2019-12-12 17:50:22
问题 I've added a new section containing a couple of new fields to an existing data template. The fields appear correctly when logged in as a normal user account. However when accessing the fields using the API, item.Fields["FieldName"] always returns NULL. Things I've tried: Publishing both the item and the corresponding data template Granting "Everyone" explicit read access to the fields (and field section). Confirmed that my dev instance is pointed to the correct database Debugging shows that

DataPager controls use Sitecore layout URL instead of item URL

久未见 提交于 2019-12-12 17:25:02
问题 To implement a search results page on a Sitecore 6.3.1 site, I created a content item at /sitecore/content/Home/Search and added a Search Results sublayout to its presentation controls. The sublayout uses a ListView to display the search results and a DataPager to handle pagination. Here is an excerpt from Search Results.ascx : <asp:ListView ID="SearchResults" runat="server"> <LayoutTemplate> <asp:DataPager ID="Pager" QueryStringField="page" runat="server"> <Fields> <asp:NumericPagerField

Spoof an IP address to test GEOIP lookups with Sitecore 8

扶醉桌前 提交于 2019-12-12 16:55:47
问题 I am new to Sitecore. I'm trying to implement following process class to overwrite GeoIP values for testing purpose. I can't find in which namespace the class Tracker is situated. Please note that I am using Sitecore 8 hosted on localhost. Sitecore Blog: @sitecorejohn blog Can some one please help me to resolve this namespace issue. Thanks. namespace Sitecore.Sharedsource.Analytics.Pipelines.StartTracking { using System.Net; using Sitecore.Analytics; using Sitecore.Analytics.Pipelines

Does @@parentid attribute work in Sitecore query?

假如想象 提交于 2019-12-12 16:15:51
问题 Sitecore reference talk about some attributes you can use in Query, including @@templatename, @@id and @@parentid etc. parentid doesn't seem to work - /sitecore/content//*[@@parentid!=''] never returns any result. While /sitecore/content//*[@@templatename!=''] works fine. Sitecore version is 6.5 and 6.6. Has anyone been able to query with @@parentid? ( Perhaps it uses Ancestor/Descendant table and I'm missing data?? - just a guess ) 回答1: It is attempting to parse the value as a GUID and

Sitecore programmatically add layout. Value cannot not be null. Parameter name Path

偶尔善良 提交于 2019-12-12 14:54:35
问题 In my previous question I figured out how to add a layout programmatically in Sitecore, this works fine when the layouts and sublayouts are the same as the Standard Values. But when this is different I get a Value cannot not be null. Parameter name Path error. I am adding a layout programatically because the requirements are to add a mobile layout when a checkbox is checked. And remove to layout when the checkbox is not checked. I've searched on the internet and added the fix from Sitecore

Get Languages chosen for publish in publish:end event

隐身守侯 提交于 2019-12-12 14:29:01
问题 I made an event handler for the publish:end event - I'm able to get which item is being published - how do I get the languages the user chose in the publish options? 回答1: Figured this out - actually the publish:end event hits once for every language - and you get get the language that is being published by doing EventArgs[0].Options.Language 来源: https://stackoverflow.com/questions/12698876/get-languages-chosen-for-publish-in-publishend-event

Sitecore + Lucene Search FieldQuery with and empty string

爱⌒轻易说出口 提交于 2019-12-12 12:19:17
问题 I'm creating a Sitecore.Ecommerce.Search.Query using FieldQuery objects. I'm then converting the Sitecore query to a Lucene.Net.Search.Query using the LuceneQueryBuilder class. Everything with the query works fine except for fields where I am trying to match on a empty string. So... this works: new FieldQuery(FieldName, "1", MatchVariant.NotEquals) but this does not: new FieldQuery(FieldName, string.Empty, MatchVariant.NotEquals) I have reflected through both the Sitecore.Ecommerce assembly

Page.Header.Controls.Add(control) is adding controls to <body> not <head>

倾然丶 夕夏残阳落幕 提交于 2019-12-12 12:11:00
问题 I'm trying add some code at run time to the head element. When I do this in the page load of a user control in the page: HtmlGenericControl hc = new HtmlGenericControl(); hc.InnerHtml = GetParameter("HeaderCode"); Page.Header.Controls.Add(hc); The control ends up in the body tag, as the first child element. For Example: ... </head> <body> <span><meta>Test</meta></span> ... From my understanding, the Page.Header is supposed to be the Head element. In the aspx page, the head has the runat=

How to generate media item link with id instead of path in Sitecore

廉价感情. 提交于 2019-12-12 11:06:39
问题 Anyone knows how to generate links in sitecore with ID instead of item path? If you use GetMediaUrl method from the API, I can get this URL: /~/media/Images/Archive/content/News and Events/News_and_Events_Level2/20070419162739/iwhiz3.jpg The problem with this approach is that if someone changes the media item name, removes it somewhere or deletes it, the above link will break. I notice if I insert a media link from rich text editor, I get the link as below: /~/media