Sitecore - Riptutorial

Transcription

sitecore#sitecore

11: sitecore222Examples22SIM2: LinkManager355Examples5URL53: 2

2323ExamplesSitecore12:23.23242424Examples24

24/242413: :2626Examples26.26true false .27ResultNotNull2727Null / amples3030303015:31Examples31ID Sitecore31Sitecore31

16:323232ExamplesID32323232Sitecore32Sitecore3234

You can share this PDF with anyone you feel could benefit from it, downloaded the latest versionfrom: sitecoreIt is an unofficial and free sitecore ebook created for educational purposes. All the content isextracted from Stack Overflow Documentation, which is written by many hardworking individuals atStack Overflow. It is neither affiliated with Stack Overflow nor official sitecore.The content is released under Creative Commons BY-SA, and the list of contributors to eachchapter are provided in the credits section at the end of this book. Images may be copyright oftheir respective owners unless otherwise specified. All trademarks and registered trademarks arethe property of their respective company owners.Use the content presented in this book at your own risk; it is not guaranteed to be correct noraccurate, please send your feedback and corrections to e1

1: sitecoresitecore ,. itecore.net/ .exe . .exe ,. [HKEY LOCAL MACHINE \ SOFTWARE \Sitecore CMS] ' / ' . . Sitecore ASP.NET .Site root zip Sitecore.https://riptutorial.com/ko/home.(). ( http://dev.sitecore.net/).2

Sitecore http://dev.sitecore.net/1. Sitecore2. . .Sitecore .Sitecore. dev.sitecore.net,. Sitecore. - Sitecore(:,, ) . - SQL Server Oracle .3. IIS " ".4. .NET Framework 4.55. DataFolder (web.config) - Dev Data Website .6. license.xml Data .7. " " . Dev. "4.2"( ) .8. "Database" Website / App Config ConnectionStrings.config9. ConnectionStrings.config MongoDB (connectionString "mongodb : ." )10. localhost http : // localhost / sitecore . Sitecore .: basics/installing-sitecore/SIMSitecore Instance Manager SitecoreAPI. Sitecore , , ,. sitecore , sitecore.https://riptutorial.com/ko/home3

SIM.sitecore : ecore-https://riptutorial.com/ko/home4

2: LinkManager public static string GetItemUrl ( ) GetItemUrl ( , UrlOptions );ExamplesURL:Item item;URL . URLstatic Sitecore.Links.LinkManager.string url LinkManager.GetItemUrl(item);UrlOptions.UrlOptions options new UrlOptions{AddAspxExtension false.};string url LinkManager.GetItemUrl(item, options);LinkManager : kmanagerhttps://riptutorial.com/ko/home5

3: SitecoreID:IDIDOOTB./., /sitecore/contentreadabiltiy ./sitecore/system/Marketing Control PanelOOTB .ID , u g .:Sitecore Query Cheat Sheethttps://riptutorial.com/ko/home(Sitecore404 ).6

https://riptutorial.com/ko/home7

ar (path: dchild:grandchild (path: uery:/sitecore/content/[@@templatename 'Homepage']:home (name: home, path: /sitecore/content/home, template name: nt ( foo-site , bar-site , baz-site ) Site Node . ( home , home , home ) Homepage ( my-account , my-account , my-account ) User AccountPage:https://riptutorial.com/ko/home8

[@@templatename 'Homepage']/*[@@templatename 'my-account']:foo-site -site -site ecore: ecore--https://riptutorial.com/ko/home9

4:(WFFM)Web Forms For Marketeers SitecoreSitecore .https://dev.sitecore.net/Downloads/Web Forms For Marketers.aspx .ExamplesWFFMWFFM.var controlResults new List ControlResult ();controlResults.Add(new ControlResult(Pdf Request Form.Name.ItemID.ToString(), "Name", name,string.Empty));controlResults.Add(new ControlResult(Pdf Request Form.Email.ItemID.ToString(), "Email", df Request Form.ItemID, controlResults.ToArray(), newIActionDefinition[] {}, DependenciesManager.ActionExecutor);(WFFM) : ---wffm-https://riptutorial.com/ko/home10

5:Sitecore. UserSwitcherSecurityDisabler .C # 'using' . UserSwitcher / SecurityDisabler .Examplesusing (new Sitecore.SecurityModel.SecurityDisabler()){var item nt/home");}.var user /testname", false);using (new Sitecore.Security.Accounts.UserSwitcher(user)){var item nt/home");}: ps://riptutorial.com/ko/home11

6:ExamplesLucene. configuration ref dexConfiguration" indexAllfields false /indexAllfields fieldNames hint "raw:AddFieldByFieldName" field fieldName "title" storageType "YES" indexType "TOKENIZED"vectorType "NO"boost "1f" type "System.String"settingType rovider"/ /fieldNames /configuration . iguration.StorageType/// summary Specifies whether and how a field should be stored. /summary public enum Store{/// summary Store the original field value in the index. This is useful for short texts/// like a document's title which should be displayed with the results. The/// value is stored in its original form, i.e. no analyzer is used before it is/// stored./// /summary YES,/// summary Do not store the field value in the index. /summary NO}IndexType/// summary Specifies whether and how a field should be indexed. /summary public enum Index{/// summary Do not index the field value. This field can thus not be searched,/// but one can still access its contents provided it is/// see cref "T:Lucene.Net.Documents.Field.Store" stored /see ./// /summary NO,https://riptutorial.com/ko/home12

/// summary Index the tokens produced by running the field's/// value through an Analyzer. This is useful for/// common text./// /summary ANALYZED,/// summary Index the field's value without using an Analyzer, so it can be searched./// As no analyzer is used the value will be stored as a single term. This is/// useful for unique Ids like product numbers./// /summary NOT ANALYZED,/// summary Expert: Index the field's value without an Analyzer,/// and also disable the storing of norms. Note that you/// can also separately enable/disable norms by calling/// see cref "!:AbstractField.SetOmitNorms" / . No norms means that/// index-time field and document boosting and field/// length normalization are disabled. The benefit is/// less memory usage as norms take up one byte of RAM/// per indexed field for every document in the index,/// during searching. Note that once you index a given/// field i with /i norms enabled, disabling norms will/// have no effect. In other words, for this to have the/// above described effect on a field, all instances of/// that field must be indexed with NOT ANALYZED NO NORMS/// from the beginning./// /summary NOT ANALYZED NO NORMS,/// summary Expert: Index the tokens produced by running the/// field's value through an Analyzer, and also/// separately disable the storing of norms. See/// see cref "F:Lucene.Net.Documents.Field.Index.NOT ANALYZED NO NORMS" / for what normsare/// and why you may want to disable them./// /summary ANALYZED NO NORMS}/// summary Specifies whether and how a field should have term vectors. /summary public enum TermVector{/// summary Do not store term vectors. /summary NO,/// summary Store the term vectors of each document. A term vector is a list/// of the document's terms and their number of occurrences in that document./// /summary YES,/// summary Store the term vector token position information////// /summary /// seealso cref "F:Lucene.Net.Documents.Field.TermVector.YES" /// /seealso WITH POSITIONS,/// summary Store the term vector Token offset information////// /summary /// seealso cref "F:Lucene.Net.Documents.Field.TermVector.YES" /// /seealso WITH OFFSETS,/// summary Store the term vector Token position and offset information////// /summary https://riptutorial.com/ko/home13

/// seealso cref "F:Lucene.Net.Documents.Field.TermVector.YES" /// /seealso /// seealso cref "F:Lucene.Net.Documents.Field.TermVector.WITH POSITIONS" /// /seealso /// seealso cref "F:Lucene.Net.Documents.Field.TermVector.WITH OFFSETS" /// /seealso WITH POSITIONS OFFSETS}Lucene.: tps://riptutorial.com/ko/home14

7:Sitecore LuceneLINQ Lucene .NET. ( : Sitecore SQL DB)Lucene . Sitecore Lucene.NET API. Sitecore. SOLR . Lucene.ExamplesSitecoreSitecore. Your.sitecore master index sitecore web indexsitecore web index.Sitecore.Site \App .Web.config. ? - ? - Sitecoresitecore web index: configurationref dexConfiguration" / . Your.Site \App ltIndexConfiguration.config. Sitecore. fieldMap ./(: ). fieldMap fieldNames hint "raw:AddFieldByFieldName" fieldshint "raw:AddComputedIndexField" . fields hint "raw:AddComputedIndexField" . OnPublishEndAsynchronousStrategy (onPublishEndAsync) .SynchronousStrategy (syncMaster) - .IntervalAsynchronousStrategy (intervalAsyncCore / intervalAsyncMaster) ManualStrategy - . ( ).RebuildAfterFullPublishStrategy (rebuildAfterFullPublish) .RemoteRebuildStrategy (remoteRebuild) - Sitecore .syncMaster.(CD) Sitecore(CM). 'onPublishEndAsync' .onPublishEndAsync remoteRebuildCDCM. strategies hint "list:AddStrategy" strategy ref tegies/onPublishEndAsync"/ /strategies https://riptutorial.com/ko/home15

Sitecore. locations hint "list:AddCrawler" crawler type "Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch" Database web /Database Root /sitecore /Root /crawler /locations Database Root . Root Sitecore.,''/.-. indexing.filterIndex.inbound processor type ApplyInboundIndexFilter,Sitecore.ContentSearch" /processor /indexing.filterIndex.inbound :public class ApplyInboundIndexVersionFilter : InboundIndexFilterProcessor{public override void Process(InboundIndexFilterArgs args){var item args.IndexableToIndex as SitecoreIndexableItem;if luded /sitecore-7-inbound-and-outbound- . filter-pipelines.aspx. indexing.filterIndex.outbound processortype " /processor /indexing.filterIndex.outbound :https://riptutorial.com/ko/home16

public class ApplyOutboundIndexWorkflowFilter : OutboundIndexFilterProcessor{public override void Process(OutboundIndexFilterArgs args){//You can use args.IsExcluded to remove items from the search results itecore-7-inbound-and-outbound- . filter-pipelines.aspx.Sitecoresitecore master index .: event name "item:versionAdded" handler type "FilterPatch.Library.ContentSearch.EventHandler, AssemblyName"method "Execute" / /event public class EventHandler{public void Execute(object sender, EventArgs eventArgs){var item Event.ExtractParameter(eventArgs, 0) as Item;//If item has less than 2 versions - then skipif(item.Versions.Count 2){return;}var indexableItem new SitecoreIndexableItem(item);var index ContentSearchManager.GetIndex(indexableItem);using (var context index.CreateDeleteContext()){foreach(var version in ons.IsLatestVersion()){var indexableItemVersion new xableItemVersion.UniqueId);}}context.Commit();}}}: ps://riptutorial.com/ko/home17

8:Sitecore. Content Management (CM) Content Delivery (CD) CM CD .ExamplesSitecore CM-CDCMCM CD.publish : end : remote on CD.1. web.config !--.ENABLE EVENT QUEUESIf enabled, Sitecore sends local events to the event queue available to remoteinstances,and handles events in the queue from remote instances.Default value: true-- setting name "EnableEventQueues" value "true" / 2. ScalabilitySettings.config .InstanceName PublishingInstance CM.ScalabilitySettings.config App Config / Include . !--INSTANCE NAMEUnique name for Sitecore instance.Default value: (machine name and IIS site name)-- setting name "InstanceName" patch:attribute name "value" BAYERUATCD /patch:attribute /setting !-- PUBLISHING INSTANCEAssigns the instance name of dedicated Sitecore installation for publishingoperations.When empty, all publishing operations are performed on the local installation ofSitecore.Default vaue: (empty)-- setting name "Publishing.PublishingInstance" patch:attribute name "value" BAYERUATCM /patch:attribute /setting !-- COUNTERS INSTANCE NAMEInstance name for performance counters.Default value: (value of InstanceName setting)-- setting name "Counters.InstanceName" patch:attribute name "value" BAYERUATCD /patch:attribute /setting !-- SECURITY CACHE EXPIRATIONSets the absolute expiration on the cached security data.A value of 00:00:00 disables automatic expiration of security caches.https://riptutorial.com/ko/home18

-- : ps://riptutorial.com/ko/home19

9:Examplespublic void MoveToStateAndExecuteActions(Item item, ID der workflowProvider IWorkflow workflow workflowProvider.GetWorkflow(item);// if item is in any workflowif (workflow ! null){using (new Sitecore.Data.Items.EditContext(item)){// update item's state to the new oneitem[Sitecore.FieldIDs.WorkflowState] workflowStateId.ToString();}Item stateItem nt, Sitecore.Data.Version.Latest, item.Database,SecurityCheck.Disable);// if there are any actions for the new stateif s workflowPipelineArgs new WorkflowPipelineArgs(item, null,null);// start executing the actionsPipeline pipeline Pipeline.Start(stateItem, workflowPipelineArgs);if (pipeline mentBy(pipeline.Processors.Count);}}Sitecore UIWorkflowProviderID Execute .public static WorkflowResult ExecuteCommand(Item item, string commandName, string comment){IWorkflow workflow f (workflow null){return new WorkflowResult(false, "No workflow assigned to item");}WorkflowCommand command .FirstOrDefault(c c.DisplayName commandName);if (command null){return new WorkflowResult(false, "Workflow command not found");}https://riptutorial.com/ko/home20

return workflow.Execute(command.CommandID, item, comment, false, new object[0]);}: tps://riptutorial.com/ko/home21

10:,.Examples"".var workflow Workflow(workflowId);workflow.Start(item);var workflowId item.Fields[" Default workflow"].Value;var workflow Workflow(workflowId);workflow.Start(item);: tps://riptutorial.com/ko/home22

11:Glass.Mapper. CMSGlass.Mapper CMS C #. Glass.Mapper.URL e.Glass.Mapper.ScC#.Sitecore.public class Demo{public virtual Guid Id { get; set; }public virtual string Title { get; set; }public virtual DateTime Date { get; set; }public virtual string Url { get; set; }}public void DoWork(ISitecoreContext sitecoreContext){var model sitecoreContext.GetCurrentItem Demo ();var url model.Url;}: tps://riptutorial.com/ko/home23

12:Unicorn Sitecore ,Sitecore . Unicorn Sitecore.: Unicorn on Github Sitecore : !Examples Sitecore 6.6 ( Sitecore 8.x ) . Sitecore 6.6 .NET 4.5 . . NuGet.PM NuGet Visual Studio README./ / lib / sitecore / v7 (v7 / v8 ) Sitecore.Kernel.dll . Visual Studio 2012 Sitecore , Rainbow.dll, Rainbow.Storage.Sc.dll, Rainbow.Storage.Yaml.dll Kamsar.WebConsole.dll( , ). * .config App Config \ Include \ Unicorn . README . yoursite / unicorn.aspx.UnicornUnicorn.UnicornUnicorn . icornDataProvider.( IPredicate ).UnicornSqlServerDataProvider.Unblockable ,.UnicornSqlServerDataProvider. .public MyDataProvider(string connectionString) :base(connectionString, new UnicornDataProvider(), newUnicornDataProvider(), .) ().https://riptutorial.com/ko/home24

public MyDataProvider(string connectionString) : base(connectionString, null){AddUnicornDataProvider(new UnicornDataProvider());// .}: ps://riptutorial.com/ko/home25

13: : Assert.ArgumentCondition ( , argumentName, )Assert.ArgumentNotNull ( , argumentName)Assert.ArgumentNotNull ( , Func string getArgumentName)Assert.ArgumentNotNullOrEmpty (ID , string argumentName)Assert.ArgumentNotNullOrEmpty ( , argumentName)Assert.ArgumentNotNullOrEmpty ( , Func getArgumentName)Assert.AreEqual (int value1, int value2, string message)Assert.AreEqual (int value1, int value2, string , params [] args)Assert.AreEqual ( 1, 2, )Assert.AreEqual ( 1, 2, , params [] args)Assert.AreEqual (bool 1, bool 2, )Assert.AreEqual (bool 1, bool 2, , params [] args)Assert.CanRunApplication ( )Assert.HasAccess (bool accessAllowed, )Assert.HasAccess ( accessAllowed, , params [] args)Assert.IsEditing ( )Assert.IsFalse ( , )Assert.IsFalse ( , Func getMessage)Assert.IsTrue ( , , params [] args)Assert.IsNotNull ( , )Assert.IsNotNull ( , , params [] args)Assert.IsNotNull ( , )Assert.IsNotNull ( , , , params [] args)Assert.IsNotNullOrEmpty ( , )Assert.IsNotNullOrEmpty ( , , params [] args)Assert.IsNull ( , )Assert.IsNull ( , , params [] args)Assert.IsTrue (bool , )Assert.IsTrue ( , Func getMessage)Assert.IsTrue ( , , params [] args)Assert.Required ( obj, )Assert.Required ( obj, , params [] args)Assert.ResultNotNull T (T , )Assert.ResultNotNull T (T ame, "xamlControls", "Xaml files must have a root nodenamed 6

true false .true false .Assert.IsFalse(Settings.DoBadThings, "Bad things should not happen, disable DoBadThings.");Assert.IsTrue(magicNumber 42, "The magic number is greater than 42!");Assert.IsFalse(myValue 5, "The value should not be greater than 5, it's currently {0}",myValue);ResultNotNullnull . null ,InvalidOperationException perationExceptionThrowreturn emRootId), string.Concat("Root itemnot found. ID: ", this.ItemRootId));null d(parameter, "parameter is required.");Null / EmptyIsNotNullnull.null .Assert.IsNotNull(database, type, "Name: {0}", Empty(propertyName, "user");IsNullIsNotNull().null .Assert.IsNull(this.StandardValues, "A Standard Values item has already been created for thistemplate e27

true .Assert.ArgumentCondition(pageIndex 0, "pageIndex", "Value must be greater than or equal tozero.");ArgumentNotNullnull .null .Assert.ArgumentNotNull(item, core IDID null .var nullId new new ID("{00000000-0000-0000-0000-000000000000}");// Both of these calls will result in an exceptionAssert.ArgumentNotNullOrEmpty((ID)null, "null");Assert.ArgumentNotNullOrEmpty(nullId, nameof(nullId));null.// Both of these calls will result in an l, "null");Assert.ArgumentNotNullOrEmpty("", lication("WebEdit");HasAccessHasAccess, true HasAccess . , AccessDeniedException r, "Only administrators can create new domains");https://riptutorial.com/ko/home28

: : https://riptutorial.com/ko/home29

14:Sitecore(, , ).(, , , ) .ExamplesContactManager contactManager Factory.CreateObject("tracking/contactManager", true) asContactManager;Contact contact n contact;(:).var stateManager ID, r.Provider);AutomationMetadataProvider automationMetadataProvider ion/metadataProvider", true) asAutomationMetadataProvider);var context eItem.ParentID, culateWakeUpDateTime(ID.Parse(fromState), SaveAutomationContext(context);: tps://riptutorial.com/ko/home30

15:ExamplesID SitecoreID.TemplateItem templateItem Sitecore.Context.Database.GetTemplate(new oreGetTemplate.TemplateItem templateItem mplate");: ps://riptutorial.com/ko/home31

16: Database.GetItem (ID itemId)Database.GetItem (ID itemId, )Database.GetItem (ID ID, , )Database.GetItem ( )Database.GetItem ( , )Database.GetItem ( , , )Sitecore.Context.Database. tem(new /content/Sitecore", Language.Current, text.Item["Field Name"];item:item["Field Name"];SitecoreSitecoreSitecore.ID targetDatabaseFieldId ;var publishingDatabases https://riptutorial.com/ko/home32

base).Select(i i[targetDatabaseFieldId]) //Get Target Databasevalue.Where (i i ! null).Select(i PublishItem(mediaItem, taticSettings.WebDatabase).ToArray(), false, false);: ps://riptutorial.com/ko/home33

S.NoContributors1sitecoreAdrian Iorgu, Community, Jack Spektor, Liam, Paritosh Tripathi,Rodrigo Peplau2LinkManagerLiam3SitecoreZachary Kniebel4(WFFM)Jack Spektor5Jack Spektor, Laurel, SamMullins6Liam7David Masters, Jack Spektor, Laurel8Jack Spektor, Liam9Rodrigo Peplau10Shriroop11Shriroop12:James de la Bastide, JohnD13Jack Spektor14Dheeraj Palagiri, Wesley Lomax15Jack Spektor, JohnD, Zachary Kniebelhttps://riptutorial.com/ko/home34

It is an unofficial and free sitecore ebook created for educational purposes. All the content is extracted from Stack Overflow Documentation, which is written by many hardworking individuals at Stack Overflow. It is neither affiliated with Stack Overflow nor official sitecore.