After many years, my blog has now moved back to this platform!
My (limited) contribution since moving the blog to sitecore.net can still be found here: https://community.sitecore.net/technical_blogs/b/sitecore_what39s_new, although the newest is from 2015, so probably a bit out of date.
I will start blogging about Sitecore again here (especially targeted at the not-so-experienced and new-to-the-platform audience), and first up, is about my new mantra and start of a movement #SimplifySitecoreDevelopment.
For a long while now, I have seen Sitecore solutions becoming over-engineered (in my opinion), resulting in a steep learning curve especially for new team members and developers new to Sitecore.
Also, unnecessary time is spent on developing the "perfect" code that (in theory) is easy to extend and adjust over time. What I have experienced is, that the time saved in the long term, rarely justifies the time spent building that perfect dependency-injection enabled, MVVM, service layered, etc. component as the requirement often change so much over time, that the component needs to be completely rebuild anyway. Or even more so the case, the platform is changed to another platform or upgraded to a newer version, where the whole site is redesigned and re-coded anyway!
Sitecore is an advanced platform, allowing any imaginable customization and you have probably heard the sentence "what you can do in .Net, you can do in Sitecore" many times if you move around the Sitecore community circles! That does not mean it is a complex platform for developers, unless they make it their mission to make it complicated!
And just to make sure I don't get everyone on my neck already, #SimplifySitecoreDevelopment does not mean abandoning the great intentions in the Helix guidelines (https://helix.sitecore.net/). On the contrary, I will make sure to follow those guidelines in the coming blog posts.
Mark Cassidy @cassidydotdk delivered a great talk on this years Sitecore Symposium (a blog post about that event is also in the making ;) on the same topic, so I am not alone in my little movement ;)
First up is a rant about ORM/strongly typed field access vs native Sitecore API:
1. Why not use the Sitecore native API (not online yet)
Tuesday, October 23, 2018
Thursday, September 30, 2010
My blog has moved
This will be my last blog post on this adress as my blog has moved to the new Community area on Sitecore.net: http://www.sitecore.net/en/Community
You will find my blog on this url: http://www.sitecore.net/en/Community/Technical-Blogs/Morten-Ljungberg-Sitecore-Whats-New.aspx
I will be porting all my previous posts too.
You will find my blog on this url: http://www.sitecore.net/en/Community/Technical-Blogs/Morten-Ljungberg-Sitecore-Whats-New.aspx
I will be porting all my previous posts too.
Tuesday, June 1, 2010
Language switching
I am mostly writing this post because I keep forgetting how to get a language different from the current context language through the Sitecore API based on a string value. So to remind myself; here we go:
Language lang = Sitecore.Globalization.Language.Parse("da-DK");
Sitecore.Context.SetLanguage(lang, true);
From here on the language will be set as da-DK no matter what the current language is.
(Remember this blog is for new Sitecore developers! So all you hardcore Sitecore developers don't give me heat for writing about too basic stuff ;))
Language lang = Sitecore.Globalization.Language.Parse("da-DK");
Sitecore.Context.SetLanguage(lang, true);
From here on the language will be set as da-DK no matter what the current language is.
(Remember this blog is for new Sitecore developers! So all you hardcore Sitecore developers don't give me heat for writing about too basic stuff ;))
Tuesday, December 22, 2009
The importance of the Data Source attribute
I know that most of you probably already know the importance of actively using the data source attribute on renderings. This has become even more important with the Online Marketing Suite.
So if you are new to Sitecore or just haven't thought about using the data source yet, read on.
I am going to use the Nicam site as an example and show how we can use the same control to output different content based on the source attribute.
In the right hand image there is a control outputting the text "D3X" on a red background with a link to the D3X page. The content item that holds the information for the control is not the current context item, but rather an item that the developer has pointed to when chosen to output that control on this specific page.
The content item looks like this:
Now to change the content I could just change the values of the content item, but if I have used the "D3X - red" content item on other pages and wants to keep the content it would be smarter to use the data source attribute to point to another content item like the one above "D3X - grey".
This way I can reuse the same control over and over on different pages (or on the same page) but change the actual content by pointing to different content items through the data source attribute.
The data source attribute is found in the "Layout Details" when clicking on a control or in Design mode when highlighting a control and then clicking on properties.
Setting the data source attribute actually means that you point to a different "context" item than the one requested by the URL. So you don't need to specify anything when extracting content from a field.
for example outputting the text from a single line text field would just be:
<sc:text field="field name">
Because omitting the "select" statement means that Sitecore will use the context item.
Online Marketing Suite
Creating controls that uses the source attribute is especially important when using the OMS for personalization or multi variant testing.
This is because the Personalization rules and MV testing both uses the data source to change the content item displayed through a control based on the rules that the user set up.
Drop me a comment if you want more info about using the data source when setting up MV testing or personalization rules.
So if you are new to Sitecore or just haven't thought about using the data source yet, read on.
I am going to use the Nicam site as an example and show how we can use the same control to output different content based on the source attribute.
In the right hand image there is a control outputting the text "D3X" on a red background with a link to the D3X page. The content item that holds the information for the control is not the current context item, but rather an item that the developer has pointed to when chosen to output that control on this specific page.
The content item looks like this:Now to change the content I could just change the values of the content item, but if I have used the "D3X - red" content item on other pages and wants to keep the content it would be smarter to use the data source attribute to point to another content item like the one above "D3X - grey".
This way I can reuse the same control over and over on different pages (or on the same page) but change the actual content by pointing to different content items through the data source attribute.
The data source attribute is found in the "Layout Details" when clicking on a control or in Design mode when highlighting a control and then clicking on properties.
Setting the data source attribute actually means that you point to a different "context" item than the one requested by the URL. So you don't need to specify anything when extracting content from a field.
for example outputting the text from a single line text field would just be:
<sc:text field="field name">
Because omitting the "select" statement means that Sitecore will use the context item.
Online Marketing Suite
Creating controls that uses the source attribute is especially important when using the OMS for personalization or multi variant testing.
This is because the Personalization rules and MV testing both uses the data source to change the content item displayed through a control based on the rules that the user set up.
Drop me a comment if you want more info about using the data source when setting up MV testing or personalization rules.
Labels:
Data Source,
Online Marketing Suite,
Sitecore
Tuesday, December 1, 2009
New icons in Sitecore 6.2
Just a quick post about the new Icons in Sitecore 6.2.
The new icons is actually just an update of the old ones to have a more Windows 7/Vista look (see small sample below).

They can be found in the Website\sitecore\shell\Themes\Standard folder as zip files together with the old icons. The icon folders have the same names as the old ones just with "V2" appended.
But when you want to use the new icons for example for a template they are not visible in the icon selector. You will still see the old ones!
To use the new ones instead of the old, rename the zip archives of the old icon zip folders to something else and then unzip the "V2" zip archives, delete the V2 from the folder name and re-zip the folder.
Now you should see the new icons
The new icons is actually just an update of the old ones to have a more Windows 7/Vista look (see small sample below).

They can be found in the Website\sitecore\shell\Themes\Standard folder as zip files together with the old icons. The icon folders have the same names as the old ones just with "V2" appended.
But when you want to use the new icons for example for a template they are not visible in the icon selector. You will still see the old ones!
To use the new ones instead of the old, rename the zip archives of the old icon zip folders to something else and then unzip the "V2" zip archives, delete the V2 from the folder name and re-zip the folder.
Now you should see the new icons
Wednesday, September 30, 2009
Using Parameter Templates in renderings
This is my first serious attempt at writing something helpfull, so I hope it will be well recieved ;)
A new feature introduced in Sitecore makes it possible to create a data template and use the fields of this template as predefined parameter names for rendering! Personally I like this very much. But how does it work?
For example consider a rendering for a top 5 songs list. That song list can be added on different pages through the page designer by the editors, but they want to be able to choose the genre of the songs that should be shown (rock, pop, country etc.).
Before this we could only add custom parameters to renderings where they were used by both typing parameter name and value, which is not very userfriendly (The editor would have to remember both Parameter name and the allowed values):
When Using Parameter templates the above properties window looks like this instead:
In the above example I have used a Parameter template with three fields, a text field, a checkbox field and a multilist field to show different types of fields can be used.
So How do we make this happen. Very easy:
Create a normal template
Make sure that the template inhirits from the standard template and the System/Layout/Rendering Parameters/Standard Rendering Parameters template. That's what makes the magic happen!
Create the rendering where the Parameter template is needed
Click on the rendering definition item and find the field called "parameters Template" and choose the template.
And voila, it all works!!
Comments about usefullness etc. is very welcome!
Tuesday, September 29, 2009
Yet another Sitecore Blog
This is my first attempt at blogging so be gentle!
This blog will mostly be about Sitecore. Not the hardcore technical stuff, but new functions/features and tips and tricks (if I can find any that hasn't been blogged already).
I am working for Sitecore so my blogging will be biased! Now you are warned ;)
This blog will mostly be about Sitecore. Not the hardcore technical stuff, but new functions/features and tips and tricks (if I can find any that hasn't been blogged already).
I am working for Sitecore so my blogging will be biased! Now you are warned ;)
Subscribe to:
Posts (Atom)


