Archive

Archive for the ‘Sitecore 9’ Category

Sitecore installation Framework (SIF) custom install path.

08/02/2019 3 comments

This is a very short post, and properly there exist different ways to achieve the same thing, but this is my take on installing Sitecore 9 in custom path.

As default when downloading the on prem package for Sitecore 9, the installation will install in “C:\inetpub\wwwroot”.

One way of installing all the different sites for a XP installation (cm/cd, XConnect, Identityserver) would be to change the “Site.PhysicalPath” in each *.json file for each role. But foreach installation you would make in the future you would have to edit all the files and change them accordingly.

So instead you could add a new parameter to *.ps1 file used to kick off the installation. But it near the top along side the other parameters needed by the installation framework

1-2019-02-08_08-48-47

Next added it as parameter to the list for SIF parameters

2-2019-02-08_08-37-46

No we have the parameters in place next we need to add updated “Site.PhysicalPath” in each *.json file but we only have to do this once. Changing the line

From
“Site.PhysicalPath”: “[joinpath(environment(‘SystemDrive’), ‘inetpub’, ‘wwwroot’, parameter(‘SiteName’))]”,

TO
“Site.PhysicalPath”: “[concat(parameter(‘InstallDir’), parameter(‘SiteName’))]”,

Last thing needed to do is to update the installation json fil. this would be the topologyenv.json fx. XP0-SingleDeveloper.json with the parameter

2019-02-12_12-45-58

For all future installation all we have to do is changing the $rootPath  parameters in the *.ps1 file to install Sitecore in a custom location.

Advertisements
Categories: Sitecore 9 Tags:

Running Sitecore 9 Field Editor from a Command in Sitecore 9 Experience editor

20/11/2017 Leave a comment

So I’ve have a post about this topics for the last couple of Sitecore Versions so of course it would make sense to have one for Sitecore 9 as well.
Start by navigating to ” /sitecore/content/Applications/WebEdit/Ribbons/WebEdit/Page Editor” in the core database. From here you can duplicate one of the existing chunk or you can create a new one.

 

 

Under your chunk create a new Button for this example I’ve used a “Sprite Large Button”. On the button you can set tootltip and a title for the button. As a field to supply the which Fields is being edited I’m using the id, with the FieldName-Fieldname-Fieldname– I’m using the “-” as a seperated between fields, and “–” to end fieldname section. See image below

 

 

 

In the Sprite section of the button you define the image to be shown in the experience editor.

 

 

Now on the presentation details for the Button

 

 

There are two important section on is the event section which holds what command is triggered

 

 

The other one the path to your script file

 

 

With Sitecore setting part in place.
You can now add the following javascript for convenience if just added the launchfielditor javascript to the root of the site


define(["sitecore", "/-/speak/v1/ExperienceEditor/ExperienceEditor.js",
"/-/speak/v1/ExperienceEditor/ExperienceEditor.Context.js"
, "/-/speak/v1/ExperienceEditor/ExperienceEditorProxy.js"],

function (Sitecore, ExperienceEditor, ExperienceEditorContext,ExperienceEditorProxy) {
Sitecore.Commands.LaunchFieldEditor =
{
canExecute: function (context) {
//YOU COULD ADD FUNCTIONALITY HERE TO SEE IF ITEMS HAVE THE CORRECT FIELDS blog.istern.dk
return true;
},
execute: function (context) {
var rawString = context.button.attributes.name;

var fields = rawString.substring(0,rawString.indexOf("--"))

var fieldsString =fields.replace(new RegExp("-","g"), "|");

var itemId = context.currentContext.itemId.replace("%7b","{").replace("%7d","}")

ExperienceEditorProxy._pe().postRequest('webedit:fieldeditor(command='+itemId+',fields='+fieldsString+',id='+itemId+')', null,false)

}

};
});

And the outcome of the above can be seen here

 

 

Only thing not happening is out save when the editor closes. But I hope to get that part in place soon.

Categories: Javascript, Sitecore 9 Tags: